We help IT Professionals succeed at work.

flash 8

197 Views
Last Modified: 2010-04-16
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?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008

Commented:
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

Author

Commented:
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.  
CERTIFIED EXPERT
Top Expert 2008

Commented:
select Button instance on stage and add following script in ActionScript panel
//-------------
on(release)
{
fscommand ("exec", "batchFile.bat");
-----------------
CERTIFIED EXPERT
Top Expert 2008

Commented:
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


Author

Commented:
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

Author

Commented:
what batch command could you use to write the text file to the directory with the projector in it?
CERTIFIED EXPERT
Top Expert 2008

Commented:
that a seperate query, which is not related to Flash part,

you can use "copycon" command

Author

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

Author

Commented:
happy to resubmit question to you in another area if you like
CERTIFIED EXPERT
Top Expert 2008

Commented:
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

Author

Commented:
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

Author

Commented:
It currently outputs it to the fscommand directory rather than to the pro directory
CERTIFIED EXPERT
Top Expert 2008
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.