• 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: 'Using Terms From ...' Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'Using Terms From ...' Question


  • Subject: Re: 'Using Terms From ...' Question
  • From: kai <email@hidden>
  • Date: Wed, 7 Feb 2007 14:02:15 +0000


On 7 Feb 2007, at 13:17, Simon Wolf wrote:

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?

Not entirely, Simon - although the use of a variable may also be helpful if, for example, a different version of an application may actually have a different name. As long as the terms used are common to all intended versions, then a 'using terms from' statement allows the script to be compiled (using the dictionary of any available version of the app) without directly specifying the application name in the tell statement.


Another good example might be that of, say, defining a scripted mail action in Mail. By itself, a 'perform mail action' handler won't compile, since it's specific to Mail:

---------------

on perform mail action with messages curr_msgs for rule curr_rule
	tell application "Mail"
		-- do something with curr_msgs
	end tell
end perform mail action with messages

--> compile error number -2741 [OSASyntaxTypeError]: "Expected “given”, “into”, “with”, “without” or other parameter name but found identifier."

---------------

While this can't be resolved by reversing the nesting...

---------------

tell application "Mail"
	on perform mail action with messages curr_msgs for rule curr_rule
		-- do something with curr_msgs
	end perform mail action with messages
end tell

--> compile error number -2741 [OSASyntaxTypeError]: "Expected “end” or “end tell” but found “on”."

---------------

... it can be with a 'using terms from' statement:

---------------

using terms from application "Mail"
	on perform mail action with messages curr_msgs for rule curr_rule
		tell application "Mail"
			-- do something with curr_msgs
		end tell
	end perform mail action with messages
end using terms from

---------------

---
kai


_______________________________________________ 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
  • Follow-Ups:
    • RE: 'Using Terms From ...' Question
      • From: "Simon Wolf" <email@hidden>
References: 
 >'Using Terms From ...' Question (From: "Simon Wolf" <email@hidden>)
 >Re: 'Using Terms From ...' Question (From: "Chris Mills" <email@hidden>)
 >Re: 'Using Terms From ...' Question (From: Simon Wolf <email@hidden>)

  • Prev by Date: Re: problem w/ text item delimiters
  • Next by Date: RE: 'Using Terms From ...' Question
  • Previous by thread: Re: 'Using Terms From ...' Question
  • Next by thread: RE: 'Using Terms From ...' Question
  • Index(es):
    • Date
    • Thread