Create AppleScript.scpt with Finder in Mavericks

Hello.

I have tried to use the make new document with Finder to make an AppleScript.

I have filled in the properties: file type, creator type and type identifier so I can’ see any difference.

Is there something I have overlooked. I can open the resulting file in AppleScript Editor, but saving it is not an option.

I am curious as to if and how I can make Finder create script files that works, because I can have one handler that makes them all.

Thanks.

You can’t create a proper script file like that in the Finder any more than you can create a proper PDF file or InDesign file like that. Use osacompile.

Thank you Shane.

Well, osacompile (and a branch in my new file script) it is then. I don’t think it ever worked to make a new pdf by Finder by the way, but it used to work to make a new script file, and it still works with Script Debuggger, haven’t tried it with AsObjC-Explorer.

Hiya,

This works for me:


tell application "Finder"
	make new file at (path to desktop folder as string) with properties {name:"new" & ".scpt"}
end tell

Kev

Having had another look at the issue, I can see the saving problem. However, how about something like this:

set theText to "my script text here"
tell application "Finder"
	set theFile to make new file at (path to desktop folder as string) with properties {name:"new" & ".scpt"}
end tell

set theFileReference to open for access file (theFile as text) with write permission
write theText to theFileReference
close access theFileReference

Kev