Re: myLoop: getting subject of messages in Mail.app
Re: myLoop: getting subject of messages in Mail.app
- Subject: Re: myLoop: getting subject of messages in Mail.app
- From: Bill Briggs <email@hidden>
- Date: Mon, 3 Mar 2003 19:24:56 -0400
At 1:50 PM -0800 03/03/03, cricket wrote:
On Friday, February 28, 2003, at 7:54 PM, Phebe Anggreani wrote:
Thanks for the reply. I actually solved it by defining the all
messages before looping:
set allMsg to all messages of front message viewer
set selectedMsg to {}
repeat with thisMsg in allMsg
This somehow works.
Your original script would work if you added 'get' before 'all
messages of front message viewer'. This is a common scripting
mistake that is _incredibly_ easy to make, so don't feel too bad. No
one else caught it on the list either, see? :)
It's not a mistake, it shouldn't be required. The 'get' is supposed
to be implicit, and with good reason. See below.
You need to evaluate 'all messages of front message viewer' first
before you can start iterating through it as a list. Putting a 'get'
in front of it causes that evaluation to happen. Before being
evaluated, think of 'all messages of front message viewer' as being
a reference to one thing that has not yet been evaluated, rather
than a list of already evaluated message objects.
By that line of argument the behaviour of "Scriptable Text Editor",
which still stands as a model of good AppleScript implementation, is
wrong. Witness.
tell application "Scriptable Text Editor"
make new document -- no location reference necessary, nor should it be
set pRef to (make new paragraph at end of document 1) --
location reference makes sense here
set text of pRef to "I am the text!"
text of pRef -- returns correct text
text of last paragraph of document 1 -- returns correct text
last character of document 1 -- returns expected character
third character of last paragraph of document 1 -- returns
expected char
end tell
Step through the code. All of the last four lines inside the tell
block return a result that is exactly as the object is specified, as
they should. Just like you don't have to say "get current date", you
only have to say "current date". Same deal. The explanation that it's
a reference waiting to be evaluated is ridiculous. The fact that the
item has been named indicates that it is requested. The 'get' is
implied by the object reference. Why else would you write the
reference? I can't imagine. By your argument I'd have to be writing
"get" all over the place to have object references evaluated. That's
plain silly because this "get", if it is required, is not how it
should be, not how it has been, and certainly not how it needs to
develop. I think this is part of what JD has been raving about.
Proper AppleScript syntax is being perverted. Scriptable Text Editor
didn't work that way because it was botched. It's supposed to be that
way.
- web
who thinks that the applications group desperately needs to hire Cal
_______________________________________________
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.