Re: What is "Using Terms From..."
Re: What is "Using Terms From..."
- Subject: Re: What is "Using Terms From..."
- From: david <email@hidden>
- Date: Wed, 21 Dec 2005 14:03:32 -0500
On Mon, 19 Dec 2005 17:18:47 -0800, Richard Bullen
<email@hidden> said:
I'm learning how to do some basic scripts to apply to mail.app.
However, the first script from apple that I opened (with the intention
of learning something) I found began with the following line:
using terms from application "Mail"
I have not come across this before and I can't find a reference to it.
Where can I find reference information on why this is used and how
it is
used.
richard:
all of the following is from "apple computer, inc." documents:
from the AppleScript 1.4.3 Read Me:
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)
**********
from applescript editor help:
Contextual menu: Tell Blocks submenu
The Tell Blocks submenu contains four options for enclosing selected
script text within a tell block.
To apply these options:
Select the script lines to be enclosed in a tell block. Optionally,
you may choose to insert an empty tell block into the script text by
placing the insertion point on a blank line.
Control-click in the selection area to access the contextual menu.
Choose the desired tell block option from the Tell Blocks submenu.
The selected text will be enclosed within the chosen tell block.
Tell Block Options
Tell "Finder": Encases the selected script text within a tell block
directed at the Finder application.
Tell "System Events": Encases the selected script text within a tell
block directed at the System Events application.
Tell Application: Encases the selected script text within an
untargeted tell block.
Using Terms Clause: Encases the selected script text within a using
terms clause.
_______________________________________________
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