• 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: AppleScript release notes released
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript release notes released


  • Subject: Re: AppleScript release notes released
  • From: Philip Aker <email@hidden>
  • Date: Mon, 05 Nov 2007 12:37:37 -0800

On 2007-11-05, at 10:01, Mark J. Reed wrote:

On 11/5/07, Christopher Nebel <email@hidden> wrote:
That depends on what the script is doing. Command-line scripts are not allowed to directly invoke user interaction commands (display dialog, choose from list, etc.), though they can tell other applications to do them.

And that is in no way new with Leopard; that's always been the case with osascript. I assume it has to do with the fact that the osascript process doesn't inherit the graphical environment directly

true

and so would have to jump through many hoops even to figure out whether or not it's being run on the console,

I think that's not necessary -- although it is a valid chain of thought. Determining that its ppid is an application process should work in the overwhelming majority of cases. Although the most common route is to go through LaunchServices, it's also possible (and easy) to use CoreFoundation to make a reasonable guess. Here I use a 'set' and then politely return to the parent:


#!/bin/sh

osascript << EOSCRIPT
set fp to ""
tell application "System Events"
set frapp to item 1 of (every application process whose frontmost is true)
set fp to name of frapp
activate
set res to (choose from list {"a", "b", "c"} with title "Important" default items "b")
end tell
tell application fp to activate
res
EOSCRIPT



much less to interact with the framebuffer (or whatever the cool kids are calling those things these days).

windowserver + CG I think. These are still relatively low in the hierarchy.



Philip Aker echo email@hidden@nl | tr a-z@. p-za-o.@



_______________________________________________
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: 
 >Re: AppleScript release notes released (From: Laine Lee <email@hidden>)
 >Re: AppleScript release notes released (From: Christopher Nebel <email@hidden>)
 >Re: AppleScript release notes released (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: prevent user input question
  • Next by Date: iCal and Leopard
  • Previous by thread: Re: AppleScript release notes released
  • Next by thread: Choose from list Bug
  • Index(es):
    • Date
    • Thread