• 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: Running AppleScript code from the Terminal?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running AppleScript code from the Terminal?


  • Subject: Re: Running AppleScript code from the Terminal?
  • From: Philip Aker <email@hidden>
  • Date: Fri, 31 Jan 2003 13:13:14 -0800

On Thursday, January 30, 2003, at 03:16 PM, Alexander Sauer-Budge wrote:

which works fine, but when I tried something like

/usr/libexec/locate.updatedb; osascript -e 'display dialog "Update complete!" buttons {"Ok"}'

I couldn't bring the dialog to the front and click on the button! I had to kill it from the terminal!


I think we tamed this pesky item a few months ago. You'll want to send the command to the current application or maybe the frontmost application. For example:

osascript -e 'tell application "Terminal" to display dialog "Update complete!"'

works when one is using Terminal. Don't even have to use the mouse. But if you tell System Events to do the same job while in Terminal, then you will have to activate it first and then tell it to do something line by line:

osascript -e 'tell application "System Events" to activate' -e 'tell application "System Events" to display dialog "Hi"'


If you need to have dialog facilities from shell scripts, you'll get much quicker dialog opening if you compile a tool and use the basic alerts available in the Carbon APIs. They'll snap up very quickly.


HTH,


Philip Aker
http://www.aker.ca
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Running AppleScript code from the Terminal? (From: Alexander Sauer-Budge <email@hidden>)

  • Prev by Date: iTunes visuals
  • Next by Date: Re: 9.2.2 Delete everything in folder except for these items?
  • Previous by thread: Re: Running AppleScript code from the Terminal?
  • Next by thread: Applescript to burst multi-page PDFs into a series of single pages
  • Index(es):
    • Date
    • Thread