• 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: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
[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)


  • Subject: Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
  • From: Philip Aker <email@hidden>
  • Date: Wed, 18 Oct 2006 05:39:26 -0700

On 2006-10-16, at 10:00:13, Bruce Robertson wrote:

There are other scripting facilities too. Tcl scripting language <x-man-page://tclsh> has AppleScript support

Hi Bruce,

I see the man page but don't see an explicit reference to how TCL supports applescript.

Sorry, I forgot it never had a man page because it started on MacOS 7 not unix. The documentation for it is actually in the Developer install:


/Developer/ADC Reference Library/documentation/DeveloperTools/Tcl/ Tclapplescript/TclAppleScript.html

Care to briefly elaborate?

Tclapplescript has more options (like for compiling and saving, etc.) but the 'execute' call is the workhorse of dynamic scripting. If you save the following as a file with execute permissions, then you can run it just like any other tool from the command line without having to use tclsh. If you want to use tclsh, then you can (optionally) leave off the first three lines. The script illustrated is "hard- quoted" script. If you need to pass variables into a script, then you can build it up with the 'append' command. All Tcl commands that have man pages use the 'n' prefix -- "man n append", "man n file", etc.



#!/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.


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: This email sent to email@hidden
  • Follow-Ups:
    • Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
      • From: Bruce Robertson <email@hidden>
References: 
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Bruce Robertson <email@hidden>)

  • Prev by Date: Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
  • Next by Date: Re: Kind of HTML files
  • Previous by thread: Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
  • Next by thread: Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script)
  • Index(es):
    • Date
    • Thread