问题
I'm trying to have a jsfl script import a video into my .fla project and export the entire thing as a .swf automatically Is it possible to disable the video wizard when importing videos? I'd hate to have to manually confirm all the options every single time. The video is in .flv format if that makes any difference
回答1:
AFAIK you can't bypass the FLV import dialog directly (using the JSFL API).
I've tried automating the FLV import wizard using a Sikuli script. The script can be run from JSFL using the undocumented FLfile.runCommandLine().
I'm using OSX so I'm not sure if this next part applies for Windows too. If I run the sikuli + the script directly:
FLfile.runCommandLine("/Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");
Flash will wait for this to run then continue importing the FLV which is a problem. The Sikuli script will timeout since the Import FLV dialog will never appear.
Still, I can run this:
FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");
And this seems to open a window of the application and runs the script asynchronously, which is great. Then I run the import. The sikuli script:
- waits for the faded out(out of focus) dialog
- clicks to get focus
- clicks the Embed FLV in SWF and play in timeline option
- waits for the dialog with the proper option selected
- clicks Continue
- waits for the next screen
- clicks Continue
- waits for the next screen
- clicks Finish
Also, on my machine, the script always worked when I had SikuliIDE open (with no particular script) and minimized.
The full test script to import a video looks like this:
var doc = fl.getDocumentDOM();
FLfile.runCommandLine("open -a /Applications/Sikuli-IDE.app/Contents/MacOS/JavaApplicationStub /Users/george/Documents/sikuli/importFLV.skl");
var path = FLfile.platformPathToURI('Users/george/Desktop/cuePointTest_1.flv');
doc.importFile(path);
You can find a recording of the script running here. After I run the JSFL script, the rest of the clicks are handled by Sikuli. You can also download the source script and the Sikuli executable script for my setup, but I imagine it will be different on yours. Sikuli is easy to use: type a command, go to your app and press CMD/Ctrl + Shift + 2 to grab a snapshot and continue.
If this does the job for your, then you can probably modify the sikuli script to wait for some time to do the clicks for the next video in the sequence, while Flash loads a new document. There should be other workarounds to manage a list of videos, but that makes sense if this solution works for your setup.
来源:https://stackoverflow.com/questions/7450387/cs5-5-import-video-through-jsfl-without-video-wizard