A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: [CS3] Load applications with Projector

  1. #1
    Member
    Join Date
    Dec 2005
    Posts
    84

    [CS3] Load applications with Projector

    greetings all.. was wondering what is the script should i use to load applications from flash projector, like example.. open winamp.exe, my computer, drives, games and many more..

    and 1 more thing, is there a way to shut down computer from flash projector?

    Any help will be appreciated.

  2. #2
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    None of these things are possible using only Flash. Flash can load programs but not from anywhere on the hard drive. If you use fscommand("exec", "filename.exe"); then it will launch a file called filename.exe in a folder called fscommand that is a subfolder of where your projector is. You can't launch programs from anywhere else because of security reasons. For those same reasons you can't shut down the computer. You could always use a 3rd party tool such as SWF Studio to add more functionality to your projector. It will allow you to launch programs from anywhere on the hard drive. I also have a command-line tool to shutdown your computer that you can embed right into your projector with SWF Studio and shut down from there. If you go with this method then it's going to cost you a bit but the functionality that is added to your projector by SWF Studio may be worth it.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  3. #3
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    anthemz, if you can create a BAT file for each task that you want to accomplish and put it in the fscommand folder beside your EXE then you should be able to launch anything you want. You can use the EXEC fscommand to launch those BAT files without any trouble. It kind of sounds like this is something you're building for yourself. If so, that will make life a bit easier for you.

    jason, check out ssCore.App.forceExitWindows. I forget exactly when it was added it but it allows you to do the shutdown/logoff/reboot right from SWF Studio.

  4. #4
    Member
    Join Date
    Dec 2005
    Posts
    84
    BAT file? how to create it? and after created BAT file, what should i add the code for the fscommand?

    and swf studio is so expensive! i can't afford it, is there any free version out there?

  5. #5
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    The fscommand is easy, just fscommand("exec", "action1.bat"); where "action1" is the name of the BAT file you want to run. You'll have a different BAT file for every action you want to perform. What you put in the BAT file depends on what you're trying to do.

  6. #6
    Member
    Join Date
    Dec 2005
    Posts
    84
    yes.. but the problem is how to create the BAT file?

    thanks..

  7. #7
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Get yourself a DOS prompt. Type in the commands you need to do whatever it is you need to do. If your commands work, open up Notepad and type those SAME COMMANDS in the SAME ORDER. Don't type what appeared on the screen, just type what you actually typed in. Save that file with a BAT extension ( For example "test.bat"). Now instead of having to type the commands, you can just double-click the batch file. Sure, your first batch file may only have two or three commands, but it counts. It's a batch program.
    That was from the Batch File ReadMe page and it's as good a place as any to get started learning about BAT files. The main page Windows 95 / DOS 7 Batch Programming applies to more thant just Windows 95 and has some good tips and links.

  8. #8
    Member
    Join Date
    Dec 2005
    Posts
    84
    thanks alot.. but i don't really understand about the DOS.. and there said "Type in the commands you need to do whatever it is you need to do", what kind of command? i don't even know how to open/enter a folder in DOS LOL!!

  9. #9
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    To start the command prompt in Windows, Go to Start>Run type CMD and hit OK. That is the command prompt To start a program you need to browse to the directory and then enter the name of the application or enter the full path to the file to launch. If there are spaces then you need to put quotes around it. Here is a screenshot of command prompt:

    You can see 2 highlighted rows. Those rows both launch Filezilla. One had me just launching it with the full path and the other had me browsing to the directory first. A BAT file lets you execute a series of commands. For instance a BAT file containing:
    Code:
    "C:\Program Files\FileZilla\FileZilla.exe"
    and another one with:
    Code:
    cd\
    cd Program Files
    cd FileZilla
    FileZilla.exe
    both do primarily the same thing.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  10. #10
    Member
    Join Date
    Dec 2005
    Posts
    84
    oMG! thanks alot buddy! it works! i save it as .bat file, and tried to run it, when the application successfully run and the command prompt are still at the background, is there a way to exit/close it after the app run?

  11. #11
    FK's Official Mac Hater jasonsplace's Avatar
    Join Date
    Mar 2002
    Location
    Provo, Utah
    Posts
    2,245
    Make the last line of the .BAT file:
    exit

    Also, if you look up Northcode's Proxy utility on this board you'll see a way to call the .BAT file without the box showing up at all. I believe you just have to download the file and put it in your fscommand folder with the same name as your bat file. For example if you .bat file is startProgram.bat then you name the file startProgram.exe and then launch it. It knows to automatically launch the bat file with the same name but it won't show the command prompt box.
    Jason L. Wright
    I'm not that hard to imitate. Just make some random negative claim at Apple or anything else for that matter and then have nothing to back it up.

  12. #12
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Make the last line of the .BAT file:
    exit
    That may or may not work, depending on what the application does. If the application does not return to the prompt until it ends then the exit line won't be called until the application ends. Better just to hide the DOS box as Jason suggests.

    I set up a new blog at northcode.com and it's the new home of all the free tools I've built over the years. They're not all up there yet, but the proxy utility is. It's part of a series of posts about FSCommand EXEC, here's the link:

    Conquering FSCommand EXEC Part1 : Proxy

  13. #13
    Member
    Join Date
    Dec 2005
    Posts
    84
    I have read the above link, but i still don't understand about the proxy.exe, and yes, i have downloaded the example.zip and tried by myself and it works! it open the pdf file without poping out the command prompt, but.. what is the proxy.exe for? to disable the command prompt from poping out? do i have to create it? or just rename it to the same name for the/all .bat file(s) name?

    What's the different between projector.exe and projector.swf.

    Thanks..

  14. #14
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    If you don't know what an SWF is then you're really going to have trouble figuring out what's going on here!

    The projector.EXE file was created by Flash from projector.FLA (the flash source file). The EXE is the standalone version of the projector.SWF file. You need the EXE because FSCommand EXEC does not work from an SWF.

    The proxy utility launches BAT files and hides the DOS box. You don't have to create it, just rename it - that's how it figures out which BAT file to run. When you run the proxy utility, the first thing it does is look at its own name. It then looks for a BAT file in the same directory with the same name (but an extension of BAT) and then it runs that BAT file. If you rename the proxy utility to xyz.exe then the utility will look for and try to run xyz.bat. If a BAT file with the same name can't be found, proxy will just fail silently.

  15. #15
    Member
    Join Date
    Dec 2005
    Posts
    84
    I see.. now i got it.. thanks..

    Can i shut down my computer from command prompt? if yes, what should i type there?

    Thanks again for all those informations!!

    edit: After a whole night sleep, wake up and try again, IT DOESN'T WORK! i add the action to button..

    ----------------------------------
    on (release) {
    fscommand("exec", "test.exe");
    }
    ----------------------------------

    and save as .swf, then create projector from it, and run... hit the button.. nothing appear!!

    I have put the test.exe, test.bat and test.pdf files in the fscommand folder.
    Last edited by anthemz; 08-10-2007 at 10:32 PM.

  16. #16
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    You can shut down your system with this utility that I created
    http://www.northcode.com/misc/reboot.exe

    Are you sure the fscommand is being called? Change it to fscommand("quit", "") just for testing to make sure.

  17. #17
    Member
    Join Date
    Dec 2005
    Posts
    84
    thanks for the reboot.exe utility, but how to use it? just double click and it will shutdown? or add fscommand ("exec", "reboot.exe")? i was planning to shutdown my computer with flash projector or swf file, hopefully it works..

    fscommand("quit", "") work with .swf
    fscommand("quit", "") work with projector

    fscommand("exec", "test.bat") no function with .swf
    fscommand("exec", "test.bat") it pop out the .bat file suddenly (about 0.01sec) and no function, it won't load the .pdf file

    tested .bat and .exe, i'm using CS3 and save player as version 9

  18. #18
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    What's in the BAT file?

    Depening on the command you've placed in the BAT file, you also have to make sure the PDF file is in the correct location.

  19. #19
    Member
    Join Date
    Dec 2005
    Posts
    84
    I didn't create any .bat file, i just use the fscommand folder from the example.zip from your website, i use the same files in the fscommand folder, then i create a new projector from CS3 and try run the script whether it is working or not.. and the answer is not working!!

    I tried to click on the test.bat files from the example.zip, and the test.pdf file run normal.

  20. #20
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    I did some digging and Flash CS3 changed the way it launches executables. If you're just trying to launch an EXE from Flash it will most likely work. But, if that EXE looks at it's own path to figure out where it is so it can launch other applications (like proxy does) then some minor adjustments will be required. The problem is that Flash CS3 now passes unicode paths. Unicode paths have always been valid, they are just a wee bit different. The biggest difference is that they have \\?\ tacked on to the beginning of the path.

    I have just fixed my proxy utility and uploaded a fix for CS3 projectors. You can get it from http://www.northcode.com/blog.php/20...C-Part-1-Proxy (it should be showing as version 3.0 now). If you're using version 1.0 or 2.0 of proxy.exe it won't work with Flash CS3 unless you target the Flash 8 player.
    Last edited by Northcode; 08-13-2007 at 09:52 AM.

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