Re: 'Using Terms From ...' Question
Re: 'Using Terms From ...' Question
- Subject: Re: 'Using Terms From ...' Question
- From: "Chris Mills" <email@hidden>
- Date: Wed, 7 Feb 2007 11:41:41 +0000
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)
On 07/02/07, Simon Wolf <
email@hidden> wrote:I am in the process of teaching myself AppleScript and one thing confuses me
slightly despite trying to do some research into it. I sometimes see 'Using
Terms From ...' in scripts, usually just before or just after a Tell
statement which refers to the same application. What does 'Using Terms
From' accomplish. I think that it allows you to use 'native' terms from
that application but I am still confused about why you need to do this when
you are using a Tell block.
Sorry to be so dense!
Simon
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.29/673 - Release Date: 06/02/2007
17:52
_______________________________________________
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//archives/applescript-users
This email sent to email@hidden
--
http://www.millshalligan.co.uk
_______________________________________________
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