• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem Scripting the Script Editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
echo email@hidden@nl | tr a-z@. p-za-o.@

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

References: 
 >Problem Scripting the Script Editor (From: Dave <email@hidden>)

  • Prev by Date: Problem Scripting the Script Editor
  • Next by Date: Re: Problem Scripting the Script Editor
  • Previous by thread: Problem Scripting the Script Editor
  • Next by thread: Re: Problem Scripting the Script Editor
  • Index(es):
    • Date
    • Thread