Re: Mac OS X 10.4: using osascript to interact with users
Re: Mac OS X 10.4: using osascript to interact with users
- Subject: Re: Mac OS X 10.4: using osascript to interact with users
- From: Philip Aker <email@hidden>
- Date: Wed, 24 Jun 2009 22:50:48 -0700
On 2009-06-24, at 21:32:18, Chris Page wrote: On Jun 12, 2009, at 10:32 AM, Philip Aker wrote:
System Events, when called from an non-windowserver process like osascript has to be jacked up to a windowserver level.
You will get a “No user interaction allowed. (-1713)” error if you attempt to display UI in osascript, because it doesn’t have UI, but if the script tells System Events to do so it should always work. i.e., as far as I am aware, System Events won’t return −1713 in response to “display alert” or “display dialog” (etc.) no matter which process sends the Apple event.
Technical point realized. I actually have jacked up osascript to have an application menu in the menu bar from one of my components and confounded that with System Events being run from osascript. It just happened that when constructing the script, the dialog was hidden behind several layers of windows and I wanted to make sure he saw the dialog and knew that it wasn't a security issue.
(It will return an error if the event is sent via EPPC, however.)
I'm only vaguely aware of EPPC and restrictions it might have compared to "normal" scripting. Is it that as a rule that no user interaction commands be used, or could one, for example, ask the Finder on the target machine to display the dialog instead of System Events.
set ppname to missing value set rslt to missing value tell application "System Events" set frapps to get name of every application process whose frontmost is true set my ppname to item 1 of frapps activate display dialog "Boston - nuttin' like drivin' 'roun' in coicles." set my rslt to POSIX path of every file of desktop folder whose visible is true end tell tell application ppname to activate rslt
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