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: Integration of Apple- and Tcl- script (Re: Applescript equivalent of $0 in shell script)



Hello, Philip. Thank you very much for your elaborated and educational examples.
Your examples run in my 10.3.9 environment.


I understand that Tcl variables can be referred naturally in Tclapplescript.
I confirmed that Tcl variable '$message' in your example is evaluated in 'append script {}'
and not in 'execute $script'.
I understand that Tcl variables cannot be set in Tclapplescript.
They must be set by the command substitution '[]'.


You have answered all of my questions in your examples and I'll rewrite my Expect/Tcl script with Tclapplescript.

With Tclapplescript, I think Expect/Tcl/Tk is one of the most versatile script languages in OS X.
(I've been a perl-hater...)


On Oct 27, 2006, at 12:50 PM, Philip Aker wrote:

###
package require Tclapplescript
rename AppleScript ascr

set pstate [ascr execute {
set pstate to missing value
tell application "iTunes"
	set pstate to get player state
	if (pstate is stopped) then
		-- many lines of code here
		return stopped
	end if
end tell
return pstate
}]

set message "\"iTunes state is: $pstate\""

append script {
tell application "Finder"
	activate
	display dialog }
append script $message
append script { buttons {"OK"} default button "OK" with icon note
end tell
}

ascr execute $script
###

---
H.T.
Any mail that does not come from this mailing list is ignored.

_______________________________________________
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: 
 >Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Philip Aker <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Philip Aker <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)
 >Re: Comprehensive Applescript Reference Book (Re: Applescript equivalent of $0 in shell script) (From: Philip Aker <email@hidden>)
 >Integration of Apple- and Tcl- script (Re: Applescript equivalent of $0 in shell script) (From: "Hiroshi T." <email@hidden>)
 >Re: Integration of Apple- and Tcl- script (Re: Applescript equivalent of $0 in shell script) (From: Philip Aker <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.