Re: run script
Re: run script
- Subject: Re: run script
- From: JJ <email@hidden>
- Date: Wed, 22 Aug 2001 23:37:37 -0700
>
1) As I understand, the command "open for acces" in the scripting additions
>
opens a text file passed as an alias. When the file doesn't exist, it
>
creates it. My question may be stupid but it is not possible to create an
>
alias to a file that doesn't exist! If I send directly a new file name
>
instead of an alias like open for access "Macintosh HD:Work:MyTextFile" it
>
doesn't work. What am I doing wrong?
>
set new_file to "HD:Desktop Folder:Inexistent_File"
open for access new_file with write permission
write "Hello, Dolly" to new_file
close access new_file
It's not for use with text files. It works with any kind of file. Usually,
it's so useful create the file before manipulating it.
i.e.
set the_Data to "GIF89a
,
@G6yDNT[Xmo{yN;4
9?"
tell application "Finder" to set newfile to make file at desktop with
properties {name:"file.gif", file type:"GIFf", creator type:"MSIE",
data:the_Data}
Where you say "
data:the_Data", you're writing text to your new file.
JJ