dcsimg
A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: publishing many .exes with different variables for each one

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    11

    publishing many .exes with different variables for each one

    evening all

    not sure if this is possible, but....

    i have a single .fla file i need to publish to an .exe multiple times. for each exe, i need it to compile with a different variable for each one.

    eg:

    my_source_file.fla compiles to:

    1.exe which has var foo = 1
    2.exe which has var foo = 2
    3.exe which has var foo = 3
    4.exe which has var foo = 4
    5.exe which has var foo = 5

    is there any way to automate this?

    cheers!

  2. #2
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Create an external .AS file which you #include. If the .AS file is generated then you can easily recompile the FLA using JSFL or my FLA2SWF tool (it's free).

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    excellent! will post my batch file once i've figured it out

    cheers

  4. #4
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The BAT file for construct will do what you need. I think. What you want to do is set up a list of values that you want to put in the AS file and call another BAT file repeatedly (once for each item in the list).

    This mainloop.bat file calls a secondary BAT file (process.bat) once for every item in the argument list. The BAT file doesn't care what you put in there, it will just call process.bat and pass each one.

    Code:
    @echo off
    for %%i in (1 2 3 "dog" "cat" "pigeon" 4 5 6) do call process.bat %%i
    All we're doing here in process.bat is creating a file called test.as that creates a var called foo that gets set to the value passed to it. Just replace the REMs with code to compile your FLA to an SWF and you're done.
    Code:
    @echo off
    
    echo var foo = %1;  > test.as
    
    REM
    REM do something with test.as here (compile)
    REM

  5. #5
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    cheers!

    the fla2swf compiles to exe too, yes?

    --------------------------------------------

    ah yes, it uses whatever settings you have in the publish settings panel!
    Last edited by vincelee888; 04-15-2009 at 06:16 AM.

  6. #6
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    using your examples, i can get it to publish the file, but only on the first iteration. as it continues through the loop, subsequent attempts to publish the file throws a 'FLA not found' error.

    eg. I get:
    Code:
    --------------------------------
    <filepath>
    --------------------------------
    OK: <filepath>
    --------------------------------
    <filepath>
    --------------------------------
    ERROR  FLA not found
    OK: <filepath>
    --------------------------------
    <filepath>
    --------------------------------
    ERROR  FLA not found
    OK: <filepath>

  7. #7
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Let me give it a whirl here and get back to you.

    What do you mainloop and process BAT files look like?

  8. #8
    Junior Member
    Join Date
    Apr 2009
    Posts
    11
    mainloop.bat

    Code:
    @echo off
    for %%i in (1 2 3) do call process.bat %%i
    process.bat

    Code:
    @echo off
    
    echo var foo = %1;  > test.as
    
    fla2swf.exe D:\test.fla

  9. #9
    Tim (Super Moderator) Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The "not found" error is a bit misleading, it's actually complaining because it can't open the FLA because it's still in use by Flash. So I made a few little modifications.

    The first change was to make a copy of test.fla using the value passed to process.bat to give the FLA a unique name each time through the loop and we compile that copy of test.fla instead of test.fla itself.

    We're now using "call" to start fla2swf instead of just launching it. This ensures that the BAT file doesn't continue until fla2swf returns.

    I'm assuming that the BAT files, FLA files and fla2swf.exe are all in the same folder so we can use .\test.fla instead of an absolute path like d:\test.fla, it just makes it easier to move this around.

    Finally, I've included a new copy of fla2swf.exe in the attached ZIP file. This one adds a one second delay before doing anything, which gives the last running copy of Flash time to quit and release the FLA it was working with before we try and start another copy. This works on my system but we might have to play with the delay to get it to work for you, I can make that a parameter to fla2swf if we need to play with it.

    main.bat

    Code:
    for %%i in (1 2 3) do call process.bat %%i
    process.bat

    Code:
    echo var foo = %1; > test.as
    call copy test.fla test%1.fla
    call fla2swf.exe .\test%1.fla
    Attached Files Attached Files

  10. #10
    Junior Member
    Join Date
    Apr 2009
    Posts
    11

    Thumbs up

    excellent - working fine now.

    few bits and bobs to automate now, but sure i can figure them out.

    thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center