Using Generator in Offline mode
Most tutorials concentrate on how to use Generator in online mode. However, using Generator in offline mode is a very flexible solution for many projects.
This tip will quickly go over how to use Generator in offline mode.
First, make sure that the path to offline Generator (generate.exe) is included in your system’s path setting. While this is not strictly necessary, it makes it easy to use offline Generator.
If you are not sure how to do this, check the documentation for your particular operating system.
We will jump right in. Here is a offline Generator command :
generate -swf test.swf test.swt -param foo bar
generate This calls offline Generator. If you have not placed the path to generate.exe in your class path, then you will have to use the entire path to generate.exe on the command line, unless you are calling it from the same directory that generate.exe is contained.
-swf This tells Generator the type of file to create. Valid options include :
- -swf : Flash movie
- -gif : gif image
- -png : png image
- -qtm : QuickTime 4 movie
- -jpg : Jpeg image
- -xwin32 : PC Flash executable
- -xmacppc : Mac Flash executable
These are not all of the file types that offline Generator can create, but are the ones used most often. Mac and PC Flash executables can only be created in offline mode.
test.swf This is the name that Generator will save the created file as. If you only supply the name, and not the entire path, then the file will be saved in the same directory from which generate.exe was called.
test.swt The template to process with offline Generator.
- -param : Any name value pairs that you want to be passed to the template. If either of the values contain a space, then you need to wrap them in quotes. For example :
- -param foo “value of foo”
You can also use multiple param tags like so :
-param foo bar -param foo2 bar2
Finally, if you are not calling generate from the directory that contains the template that you want to use, or that you want to save the generated file into, then you must pass the path names via the command line (either absolute or relative).
Absolute:
generate -swf "c:flashFiles est.swf" "c: emplates est.swt" -param foo bar
Relative:
generate -swf "images est.swf" ".. est.swt" -param foo bar
While the double quotes are not necessary in all cases, it is good practice to use them