Link to home
Start Free TrialLog in
Avatar of Dier02
Dier02Flag for Australia

asked on

flash 8

I have a flash swf and in it I have a dynamic text box.  I have a number of buttons underneath the text box.  Each button when clicked should run a batch file which creates a text file - the dynamic text box reads that text file and renders the text in the swf.  How do I get the buttons to open the batch files?
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

1.
flash swf can't run .bat file,

2.
Although If you create Flash Projector, it can run .bat file, but still there are few conditions to run batch file from a flash projector

3.
you must have a folder "fscommand" parallel to your Flash Projector, and must have .bat files in this folder, then only flash projector can run it.

4.
I assume you created the folder "fscommand" and placed ur .bat files in it.. now following code in flash will execute .bat file:
//-----------------
fscommand ("exec", "batchFile.bat");
//---------------

IMPORTANT, you dont need to specify "fscommand" folder name with .bat file name, Flash projector will itself look for .bat file in "fscommand" folder and run it.


- Aneesh Chopra

Avatar of Dier02

ASKER

I want to link this command to a button so that when I click the button the fscommand and batch file is executed.  This is just an idea I had and wanted to test but the concept is this - I want to drag a button onto a particular area.  Then some sort of hit test occurs which identifies the button - executes the fscommand for that button which outputs a text file which is then read into the dynamic text box.  Is that possible?

For example - say I have three employees named fred, tom and jack.  When I drag jacks nametag to a specific place on placing it there it causes an fs command that has a bat file write a specific text (NAme, address, phone number etc) and this is displayed in the dynamic text file window.  
select Button instance on stage and add following script in ActionScript panel
//-------------
on(release)
{
fscommand ("exec", "batchFile.bat");
-----------------
Oops, by mistake submit button gets pressed, and incomplete comment get publish,,
please ignore previous comment, here is the complete response


select Button instance on stage and press F9 to open Actioscript panel,

now add following script in ActionScript panel:
//-------------
on(release)
{
  fscommand ("exec", "batchFile.bat");
}
-----------------

But this code will run .bat file only if swf gets converted into Flash Projector and .bat file is residing in folder "fscommand" and folder "fscommand" must  besides Flash projector

- Aneesh Chopra


Avatar of Dier02

ASKER

The only problem with this is that the text file that the bat outputs goes into thefscommand folder instead of the directory above it where the projector resides
Avatar of Dier02

ASKER

what batch command could you use to write the text file to the directory with the projector in it?
that a seperate query, which is not related to Flash part,

you can use "copycon" command

Avatar of Dier02

ASKER

copycon what - for example my batch file is called var1 and the text file it outputs is called var1.txt - thanks for your patience
Avatar of Dier02

ASKER

happy to resubmit question to you in another area if you like
Ok,
here is the var1.bat file which will write var1.txt file

var1.bat content:
----------------------
echo this is the content of text file >>var1.txt
exit
--------------------

- Aneesh Chopra
Avatar of Dier02

ASKER

Thanks but I have done that-  the problem is that it writes the text file to the "fscommand" folder instead of the folder above it (called "pro") with the projector in it.  When I manually move the text file then the projector can "see" it.  I wanted the batch file to write the text file to the same directory as the projector is in
Avatar of Dier02

ASKER

It currently outputs it to the fscommand directory rather than to the pro directory
ASKER CERTIFIED SOLUTION
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial