Re: Script to Copy/Paste Entourage Message Bodies
Re: Script to Copy/Paste Entourage Message Bodies
- Subject: Re: Script to Copy/Paste Entourage Message Bodies
- From: Paul Skinner <email@hidden>
- Date: Wed, 26 Mar 2003 23:29:56 -0500
On Wednesday, March 26, 2003, at 10:12 PM, John Delacour wrote:
At 5:38 pm -0500 26/3/03, Paul Skinner wrote:
--but...
tell application "TextEdit"
tell document 1
text -->text
end tell
end tell
And 'get' isn't the answer to this one. 'it's' works. Why?
You'd get the same result in most apps, not just TextEdit.
tell application "TextEdit"
tell front document
{class of text, class of its text}
--> {class, text}
end tell
end tell
Bsides, 'text' is not a property of 'document' in the Standard Suite
that you are addressing.
tell application "TextEdit"
tell front document
{text, path, name, modified}
--> {text, "/Users/jd/junk.txt", "junk.txt", true}
end tell
end tell
You owe this 3 am. answer to a neighbour's car alarm.
JD
You wouldn't believe how tricky getting the IP of that car was. : )
Seriously, I realize that you're correct for quite a few apps, but not
for all. I must have developed an expectation for that structure to
work from using the apps I frequently work with. Let's see...
tell application "TextEdit"
tell window 1
name -->"smarty pants"
end tell
end tell
I think that it's just a basic feature of the language. [looking...]
ASLG p.168
Complete and Partial References
A complete reference has enough information to identify an object or
objects
uniquely. For a reference to an application object to be complete, its
outermost
container must be the application itself, as in
version of application "Finder" --result: "8.5"
In contrast, partial references do not specify enough information to
identify an
object or objects uniquely; for example:
delete file 1 of disk 4
When AppleScript encounters a partial reference, it attempts to use the
default
target specified in the Tell statement to complete the reference. The
default
target of a Tell statement is the object that receives commands if no
other object
is specified. For example, the following Tell statement tells the
Finder to delete
the first file of the fourth disk, using the previous partial reference.
tell application "Finder"
delete file 1 of disk 4
end tell
Similarly, the following Tell statement tells the front document of the
application AppleWorks to get the style of its text.
tell document 1 of application "AppleWorks"
get style of text body
end tell
Tell statements can contain other Tell statements, called nested Tell
statements.
When AppleScript encounters a partial reference in a nested Tell
statement, it
tries to complete the reference starting with the innermost Tell
statement. If that
does not provide enough information, AppleScript uses the direct object
of the
next Tell statement, and so on. For example, the following Tell
statement is
equivalent to the previous Finder example.
tell application "Finder"
tell file 1 of disk 4
delete
end tell
end tell
This example works because all of the nested statements target the same
application, the Finder. For information on restrictions in using
nested Tell
statements, see Tell Statements (page 240).'
Why this isn't implemented in apps at this level I haven't a clue.
Consistent inconsistency?
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.