I'm writing a scripting addition. One of the functions I have
implemented is a command that lets the user read a certain type of
file (a standard MIDI file). My command accepts a file reference
that the user can get from the "choose file" applescript command
("set blahblah to read MIDI file (choose file)")--it works great.
Now I'm trying to go the other way, with a command that accepts
data and a reference to a file that does not yet exist; the command
will create the new file, write the data in the appropriate format,
and close the file. I would expect this file name to come from the
user selecting a file in the standard Mac directory dialog.
The AppleScript Language Guide is obviously a a bit dated, saying,
"You can obtain a file specification from the New File scripting
addition command distributed with AppleScript, or from an
application command that returns a file specification," and giving
the following example:
set fileSpec to new file default name "New Report"
class of fileSpec --result: file specification
Well, there is no "New File scripting addition". How can I do this?
I'd like to avoid scripting to a third application to get the job
done (that is, if it's not built in, I'll probably have to write my
own command).
Thanks