Test Multiple Files
Some times you will need to update a number of flash files. Perhaps because you have included a fix in some shared class and want all the files using that class to be re-published. In short this scripts lets you batch publish a number flash files.
/**
* @author Warren Sangster
*/
var path = 'file:///d|/projects/portview/www.portview.co.uk/trunk/dev/source/'
var movies = [ path+'about_us.fla',
path+'contact.fla',
path+'clients.fla',
path+'history_connector.fla',
path+'index.fla',
path+'news.fla',
path+'people.fla',
path+'project_item.fla',
path+'projects.fla',
path+'services.fla',
path+'tree_menu.fla',
path+'xml_menu.fla'
];
var l = movies.length;
for(var i=0;i<l;i++){
movie = fl.openDocument(movies[i]);
movie.testMovie();
movie.close();
}
Extending
There are of course any number of extensions you could make to this simple script. It simple allows you to perform the same action to a number of files. You could use this in conjunction with scripts that creates a list of files.
Print Out Filenames
Requirements
Windows Ruby
Description
The following is a simple Ruby script that creates a text file with the names of all the files in the directory it’s run.
# Short format
files = `DIR /B`
# Directories and sub directories
#files = `DIR /S`
file_list = File.open("list.txt","w")
$stdout = file_list
# Print out each file
files.each do |f|
puts f.to_s
end
Combinations Use this with the testmovie.jsfl(Javascript Flash) to test all the flash files within a directory. Although the path will have to be reformatted slightly.
Changing the Publish Settings
I was looking for a way to automate a change in the publish settings for a flash file. Alas I wasn’t able to find out where this was set of even you could with .jsfl.
I did however come across a script by Steven Sacks. This allows you temporarily change the publish settings for the length of the command and therefore publish the file to a new location.
Create Directories
This is another Ruby script that will load a file called ‘validated.txt’. This file contains a list of directories that are subsequently created. Very minor script but nicer than creating a renaming a large number of folders.
# Creates the directories to be used
# Load the file containing the directories
require 'fileutils'
file = File.open('validated.txt','r')
# Create directories
file.each_line do |line|
FileUtils.mkdir_p line.chomp!+'/'
end
FLVCheck on multiple files
My friend did me up a quick rake script to test multiple flv files. This was very useful when we were relying on our client for the Flash Video files since allot of them were corrupt. Using this quick script we could quickly tell them what files needed re-created.
Anyhow the rake script is as follows.
SRC = FileList["*.flv"]
task :default => [:check]
task :check => SRC do
SRC.each do |t|
sh "flvcheck -f #{t}"
end
end
Incidentally any Actionscript programmers who only use the one language I would recommend giving Ruby a try I have found it very useful for a variety of web related tasks. A number of the automation tips use Ruby.
Comment on Page
If anything is unclear or just plain wrong let us know and should ammend it pretty sharpish. If you visited the page with a particular question leave it and if it's flash related I'll try to answer it.