Re: 'Using Terms From ...' Question
Re: 'Using Terms From ...' Question
- Subject: Re: 'Using Terms From ...' Question
- From: Simon Wolf <email@hidden>
- Date: Wed, 7 Feb 2007 13:17:17 +0000
Thanks Chris. So I can see how this helps when running remote
applications because it allow the script to compile against your
local machine rather than needing to attach to the remote computer
but what about local instances? Is it only used to allow
applications to be specified via variables and to allow AppleScript
to still compile the script?
Thanks.
Simon
On 7 Feb 2007, at 11:41, Chris Mills wrote:
Simon, this is from the apple web site and explains it's use quite
well I think.
Cheers
Support for "Using" Clause
A new block structure has been included to allow scripts to be
compiled without connecting to the actual target application. This
is especially useful if the application is unknown at compilation
time (for example, the application goes by different names on
different machines) or it's awkward to connect to it during script
development (for remote applications over TCP/IP, for example). The
syntax of the "using terms from" block is as follows:
using terms from application-object[of machine-object[of zone-object]]
statement(s) ...
end using terms from
Statements inside this block are compiled as if enclosed in a
"Tell" block for that application, but their targeting is
unaffected; if inside another "Tell" block, that "Tell" block's
target is used; if not, the current application is targeted. Blocks
for "Tell" and "using terms from" can be nested inside each other.
This is a more clear substitute for the commonly-used "double tell
block" to target unknown applications:
set the_reply to display dialog "Enter name or URL of remote
machine:" default answer ""
set m to machine (text returned of the_reply)
tell application "Finder" of m -- Target a remote machine
using terms from application "Finder" -- but use terminology
from local machine's Finder
set the_list to (name of every process) -- "process" is a
Finder-specific term
end using terms from
end tell
set the_application to first item of (choose from list the_list
with prompt "Choose an application:")
tell application the_application of m
set the_version to version
end tell
display dialog "The version of that application is " & (the_version
as string)
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden