Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)



On 2006-10-19, at 09:47:42, Bruce Robertson wrote:

#!/bin/sh
# tclsh ignores the next line because comments are continued with a
backslash \
exec tclsh "$0" "$@"

package require Tclapplescript

AppleScript execute {
tell application "Finder"
activate
display dialog "Wins the Lottery!" with icon note
end tell
}

PS: Watch it if you clip this from Apple Mail, sometimes spurious characters not good for shell scripts creep in depending on encoding factors. You should be able to get rid of them by using the 'nano' editor.

Thanks! I note this commment from the end of the documenation you mention:

"The AppleScript command is a stopgap command to fill the place of exec on the Mac. It is not a supported command, and will likely change as we broaden it to allow communication with other OSA languages."

That's from System 7 as well (Tcl did not have the 'exec' command implemented on OS 7/8/9). It's position on OS X is at the highest per- platform level of extensions. The directory containing those is located at /System/Library/Tcl.


As things stand today, using TclApplescript will be faster than using osascript because it keeps the component loaded until the caller quits or you call 'package forget Tclapplescript'.

BTW, the original author of this extension is Jim Ingham. He has been an engineer with Apple since OS X (on the debugging team) but championed Tcl on the Mac for 10 years before that at Sun and Lucent.


Philip Aker email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Bruce Robertson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.