Link to home
Start Free TrialLog in
Avatar of noir20754
noir20754

asked on

How to write a text file with Actionscript

I need to know how to write a text file using Actionscript without using a server.  This swf will run from a cd and must be able to write to the user's computer.
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

Howdy...

You cannot do that with the SWF...  You will need to use third party projector tools such as Zinc or SWF Studio to create EXE file and then use that to create a text file...

CyanBlue
Sometimes this will not a efficient way.
Using getURL command call a external DOS BAT file with passing parameters to it.
eg: getURL("script1.bat parameter1 parameter2 parameter3)

Inside BAT file use $1, $2, $3 for capture parameter1, parameter2, parameter3 values.
Then inside bat file to write to external text file you can use

echo $1 "is parameter1" > textfile.txt
 echo $2 "is parameter2" >> textfile.txt
echo $3 "is parameter3" >> textfile.txt

likewise you can write.
If you want you can replace this BAT file with VB generated exe or some other language generated exe file.

BR Dushan
Avatar of noir20754
noir20754

ASKER

Dushan911, I have tried your method and it seems like it should work, however there are two problems.  As typed, I cannot figure where you intend to close string and none of my guesses have been correct; please type the getURL command exactly.  Second, when I run it without sending any arguments, a box pops up asking me whether I wish to let the file run.  This is merely WIndows virus protection, but would be annoying and confusing to my end users.  Is there a way to avoid this (perhaps  by using fscommand)?
ASKER CERTIFIED SOLUTION
Avatar of Ramy_atef
Ramy_atef

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