A Flash Developer Resource Site

Page 5 of 8 FirstFirst 12345678 LastLast
Results 81 to 100 of 154

Thread: Northcode's Runtime.exe verses Proxy.exe

  1. #81
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Is M001pdf_script a variable name or the name of your script? If it's the name of your script then you need to call the EXEC command like this to make it work...

    fscommand("exec", "M001pdf_script");

  2. #82
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    Sorry to bring up an old thread..

    Northcode-

    1.)..first CD-projector project ..and I learned MUCH during this thread. Your staying with the thread until the end...top notch.



    Now..on to my question I kwow the 2Desktop saves a file to the users desktop... and the NEW version opens a SAVE dialog box....

    Is there anyway to specifiy WHERE you want a file to be saved (like hard coded somewhere) and have it always be the same...WITHOUT a SAVE AS dialog box showing? (or a DOS box.)??

    Basically...like for an UPDATE from a CD..

    click here to update your version:

    it just finds the path...
    example: ("C:\Program Files\version.exe")

    ..and overwrites file... I would prefer to NOT have the confirm overwrite file box..but not essential...

    FREE would be BEST....but my boss would probably spring for a 3rdparty utility..is not tooo much.. =)


    thanks for ANY ideas you can provide for a solution to this.

    thanks

    -whispers-

  3. #83
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Sure, you can just combine my FREE Proxy utility with a plain old COPY command in a BAT file. Proxy will hide the DOS box when the BAT file runs.

    If you need to find a special folder (like Program Files) to use as the base for the copy then you might need help from an external utility, but you can find a lot of common locations in environment variables that Windows creates for you though - and they are eaily usable from BAT files.

  4. #84
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756
    OK..thanks..so I dont need any 3rd party utility?

    Now for the hard part... I dont think I have ever written a BAT file before... (maybe when I tried to open a .PDF file from CD....once..ALONG ago!) LOL..



    Any helpful links to where I can read up on writing a COPY command in a BAT file?

    I think I can drudge my way through your PROXY utility..(lots of helpful posts in here alone)..


    Also....where can I find out about "environment variables"?

    I think I am going to try one "button" that does it the secret..silent way....and one "button" that opens a SAVE window..in case it was installed to a custom location....


    Any ideas?..or tips? on how to accomplish this?..thing I should be aware of?

    the ABOVE help would be most helpfulll and QUITE enough though.. =)

    The 3rd party app. I "MIGHT" need...would this be like an .exe on the cd that I "call" to find/place the file in the users C:\programfiles\etc\etc\etc ??


    thanks

    -whispers-

  5. #85
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    If you just type "SET" at a DOS prompt and hit enter you'll get a list of available environment variables. Thesre are things that Windows create for you to use in BAT files and applications. The contain many useful pieces of information and point to folders commonly required by BAT files. When you see things like this in the environment variable list...

    SystemDrive=C:
    SystemRoot=C:\WINNT

    You can use them in BAT files by putting "%" signs on either side of the variable name, that tells the command processor (that interprets your BAT files) to replace the %whatever% with the contents of the environment variabled named "whatever".

    Try this simple example in a BAT file to see environment variable substitution in action

    Code:
    echo The system drive is %SystemDrive%

  6. #86
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,756

    Simple COPY command .BAT file..

    OK...I have my proxy.exe (renamed to update.exe) and my .bat file (named update.bat) located in the FSCOMMAND folder...

    Would my .BAT file be like this? (tyring to save the file to program files/diretory_Name)

    update.bat:
    Code:
    copy /Y "\update\*.*" "%programfiles%\rootFolder\subFolder"
    (thank you to Northcode for supplying me with this)

    using the %programfiles% is using the environment variables to find the program files diretory..no matter what OS? or user profile..etc..etc correct?



    Now to perform a check to see if the FILE (or is it directory) already exists I would use this command line:
    Code:
    md %programfiles%\rootFolder\subFolder
    And this is a check to see if the "FILE" exsists?..(right?)
    Code:
    if not exist "%programfiles%\rootFolder\subFolder\fileName.exe"
    What is the MD stand for (alwyas thought it was make directory)
    Is this to check for the directrory? or to check for the FILE? What if the directory does NOT exsist? Does it create one? (I probably do NOT want that then)..if NOT there..proabably want it to abort or say "No such directory..please check installation path" (or whatever)

    Basically this file HAS to exsist..or theres no point in copying..(it should OVERWRITE..not just copy to a blank directory)


    Now...how do I utilize "SAY.exe"? DO I have to brun in through the .bat file like 2desktop?
    example: "say \documents\readme.pdf" (which I know it isnt right..but I dont how the strings are pased to say.exe?)


    SO my .BAT file (without adding any kind of "check" to see if "copy" was successfull) would look like this? :

    Code:
    REM ** copy command from CD > ProgramFiles**
    copy /y "\update\fileName.exe" "%programfiles%\rootFolder\subFolder"
    
    
    REM ** check to se if "FILE" exsists (after COPY command)**
    if not exist "%programfiles%\Myapp\myfile.txt" goto error
    
    :okay
    Update was Successfull
    goto done
    
    :error
    The copy failed or the file does NOT exsist.
    
    :done

    Am I understanding everything correctly so far? Does everythign look correct?


    Now I will try to tackle the "response" back to flash part (reading a text file from the C: drive.)

    Can this be cheated or something? Maybe when the alert pop-up shows..the click "OK" button..or close it..the focus would be on the "CD" again...is there anyway to maybe provoke an action form an onFocus event? (once they close pop-up defaults back to focuson CD menu)??


    Thought Id ask! LOL

    Thanks

    I will post back on the common text file part for passing a DONE value back to FLASH


    -whispers-

  7. #87
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    MD is make directory. Saying md %programfiles%\rootFolder\subFolder will work on 2000 and probably XP, but I'm not 100% about Win9x and ME. To be safe you can do it in two steps (see below) to make sure it works on all operating systems.

    Code:
    md %programfiles%\rootFolder
    md %programfiles%\rootFolder\subFolder
    If you want you can check the special errorlevel variable that the command processor sets after each command and jump to an error label. If the command completed successfully then the errorlevel will be 0, otherwise the errorlevel has a non-zero value.

    Testing the special errorlevel variable is a bit different, if you want to test for any errorlevel except 0 then you say "if errorlevel 1" which really means any errorlevel of 1 or higher. So to test for any error after an MD or COPY command, you can do this...

    Code:
    md %programfiles%\rootFolder
    if errorlevel 1 goto error1
    
    md %programfiles%\rootFolder\subFolder
    if errorlevel 1 goto error2
    
    copy /y "\update\fileName.exe" "%programfiles%\rootFolder\subFolder"
    if errorlevel 1 goto error3
    
    :okay
    REM ** if we get here everything is okay
    
    :error1
    echo could not create %programfiles%\rootFolder
    goto done
    
    :error2
    echo could not create %programfiles%\rootFolder\subFolder
    goto done
    
    :error3
    echo the copy command failed
    goto done
    
    :done
    If you combine that with the example I showed you in the other thread, you can just set the status variable in the text file and you don't need to use the SAY utility, you can display your errors in Flash.

  8. #88
    Junior Member
    Join Date
    Jan 2005
    Posts
    13
    I'm trying to make a cross platform projector with a button that will open a PDF in the users default viewer. I used the Applescript found in this thread and finally got it to work. I have the folowing script in the first frame of the movie

    function SmartExec(file)
    {
    platform = $version.slice(0, 3);
    if (platform == "WIN") {
    fscommnd("exec", file+".exe");
    } else {
    fscommand("exec", file+".app");
    }
    }

    and added the call for the function to the button. When I output the Projector I get the folowing message in the output window.

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 5: There is no method with the name 'slice'.
    platform = $version.slice(0, 3);

    Any ideas?

    Also I hade to change .scpt to .app to get the appelescript to work on its own. I have also seen it writen _scpt. What is the difference between the three versions? Does it make a difference?

    Thanks

  9. #89
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    If the version of Flash you're using doesn't support slice, you can change the function to use substring instead of slice, like this...

    Code:
    function SmartExec(file) 
    {
       platform = substring($version, 0, 3);
       if (platform == "WIN") {
          fscommnd("exec", file+".exe");
       } else {
          fscommand("exec", file+".app");
       }
    }

  10. #90
    Junior Member
    Join Date
    Jan 2005
    Posts
    13
    Thanks for the quick response.

    The code you sugested works fine on Flash MX 2004.

    Does anyone know what the difference between the Applescript extensions _scpt, .scpt and .app are? If I use .app, which is the only one that works on my MAC (OSX 10.3), will it work on other OSX versions? What about applescripts OS 9?

  11. #91
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    the "_" stuff was just a convention I use for my own convenience, you can adjust the SmartExec function to execute whatever you like as long as you're consistent in how you name your files so SmartExec can find them.

    The source for AppleScript files is normally stored in a .scpt file by the script editor and .app files are created when you compile an AppleScript.

  12. #92
    Junior Member
    Join Date
    Jan 2005
    Posts
    13
    I have proxy.exe working, Applescript working and SmartExec working. I am having trouble having the bat file find the PDF file in a folder other than fscommand.

    I want to put the PDF's in a folder in the root called PDF. My bat file reads:

    ===============
    START \PDF\testfile.pdf
    ===============

    Is this correct? This dosen't work with the files on the hard drive. Do I have to burn a cd for it to work?

    Also I found a typo in the SmartExec code in most of the posts in this thread. On the the line after

    if (platform == "WIN") {

    fscommand is missing the "a".

    Thanks again for all your help.

  13. #93
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Since you're using \pdf\testfile.pdf, Windows is going to look at the root of whatever drive you run that BAT file on for a folder called PDF and then for testfile.pdf in there. If you move your files to the root of your C: drive and try it from there it should work, otherwise you will have to burn it to a CD to test it properly.

  14. #94
    Junior Member
    Join Date
    Jan 2005
    Posts
    13
    I thought I had it all worked out. The whole process, Applescript, Bat, exe file and your SmartExec function all worked on a test movie. Here's my code:

    ===========================
    function SmartExec(file)
    {
    platform = substring($version, 0, 3);
    trace (platform);
    if (platform == "WIN") {
    fscommand("exec", file+".exe");
    } else {
    fscommand("exec", file+".app");
    }
    }
    ============================

    When I tried it in my project it failed on Win. When I traced "platform" in a simple test it returns WIN or MAC and the fuction works. When I trace in my project it returns "und".

    So I tried this function:

    ===========================
    function SmartExec(file)
    {
    fscommand("exec", file+".exe");
    fscommand("exec", file+".app");

    }
    ===========================

    Windows ignores the .app fscommand and Mac ignores the .exe fscommand. This seems to work on both platforms.

    So first any idea why the SmartExec fuction won't work when its burried several movie clips deep in my project.

    And second is there anything wrong with using my fuction that seems to work?

    I know it's difficult to debug without seeing the whole project, but mabey you have some idea where to look.

  15. #95
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    When I tried it in my project it failed on Win. When I traced "platform" in a simple test it returns WIN or MAC and the fuction works. When I trace in my project it returns "und".
    I'm guessing that "und" is actually part of "undefined"

    If you put the SmartExec function IN a movieclip then you'll have to use _root.$version instead of just $version. It's easier just to put the SmartExec function in the first frame of the main timeline where everyone can see it.

  16. #96
    Junior Member
    Join Date
    Nov 2004
    Posts
    14
    I have a different problem concerning north's proxy utility. I used to have a huge program that I subdivided into 4 smaller programs.

    Now my question is this: I have 3 smaller EXEs, each containing a button to go to one another.
    I used proxy.exe and it worked out fine in opening each small EXE individually. Is it possible that when I click the button to go to the other EXE, the current one closes and the desired one opens.

    these are the codes I put in:

    ===========================
    on (release) {
    stop
    fscommand ("exec", "menu2.exe");
    fscommand ("quit", "true");
    }
    ===========================

    this is presuming I want to go to the second menu and close the current one. The menu2.exe is the "proxy.exe" which i renamed.
    I made a .bat file that had this in:

    ===========================
    START fscommand\menu2.exe
    ===========================
    this is the case since I had all all the original EXEs in a subfolder "fscommand". My .bat and proxy files are not in the subfolder "fscommand" but I used a folder "myprogram" and in it were the .bat files and the renamed proxy files and the subfolder "fscommand".


    If any of you guys can help me out with this it would be great!

  17. #97
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    My longwinded reply/solution can be found in http://www.flashkit.com/board/showth...postid=3192223
    Last edited by Northcode; 01-24-2005 at 02:13 PM.

  18. #98
    Junior Member
    Join Date
    Nov 2004
    Posts
    14
    Whew! Thanks North! You da man! I think this will probably work so I'll give it a shot and see if it goes. Hopefully it'll run after I apply the solution of grandmaster jedi northcode! Wish me luck.

  19. #99
    Junior Member
    Join Date
    Nov 2004
    Posts
    14
    Aaarghh! Help north! It still won't work! I followed your's instrcutions to the letter and nothing happens. I tried adding a
    fscommand("quit", "true) after fscommand("exec", "menu1.exe") and all it does is close the window. The "exec" doesn't seem to work. I did everything including putting the .bat and renamed proxy files in a subfolder "fscommand". I have a question though.. what does this code actually do anyway?

    --------------------
    rem this is menu1.bat
    \menu1.exe
    --------------------

    what's the rem for?
    why doesn't the fscommand("exec".... work?


    Anyway if you guys have any more suggestions I'd appreciate it. As for me I'll all solutioned-out. Thanks!

  20. #100
    Junior Member
    Join Date
    Jan 2005
    Posts
    13
    You are missing START from the code of your BAT file. It should read:

    ================
    START \menu1.exe
    ================

    As Northcode has explained to me, and it does work, the "\" will call the menu1.exe from the root of your CD. If you are testing from your hard drive. Put the file menu1.exe in the root of you C drive (or whatever drive your project is on).

    The line with the Rem is just a comment. Rem is like // in actionScript.

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