Re: Problem Scripting the Script Editor
Re: Problem Scripting the Script Editor
- Subject: Re: Problem Scripting the Script Editor
- From: Philip Aker <email@hidden>
- Date: Tue, 30 Sep 2008 12:25:07 -0700
On Sep 30, 2008, at 11:14 AM, Dave wrote: Hi All,
I'm having problems scripting the Script Editor, Please see following script:
tell application "Script Editor" set myWindow to make new document set myText to "on run" & return & "beep" & return & "end run" & return set the text of myWindow to myText compile myWindow save myWindow as "application" in "/Users/Dave/Test1.app" without runonly and startup screen end tell
This creates a new window, add the text correctly, compiles it ok, but does not save the file as an application as expected. I don't get an error message or any indication that the save didn't work, just no Test1.app file at the end of it!
What am I doing wrong?
There are benefits to reading an application's dictionary :-)
set app_path to ((path to desktop as text) & "test.app") set scpt to "on run" & return & "beep" & return & "end run" & return
tell application "Script Editor" set docu to make new document set text of docu to scpt compile docu save docu as "application" in app_path without run only and startup screen end tell
You'll probably want to use a 'try' block in the above to catch errors when scripts are compiled.
Philip Aker
Democracy: Two wolves and a sheep voting on lunch.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden