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: John Delacour <email@hidden>
- Date: Mon, 3 Mar 2003 22:41:49 +0000
- Mac-eudora-version: 6.0a8
At 1:50 pm -0800 3/3/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? :)
Probably because it's not a "mistake" in almost any other
application. The mistake is the one made by your programmers. Just
look at a few applications that do things properly. I keep getting
this feeling I'm having my English corrected by a six-year-old.
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.
This is not so even in TextEdit, let alone non-Apple applications.
There are exceptions but they must be making the same mistake as you.
tell application "TextEdit" to first item in windows -- or 'of windows'
--> window id 34089 of application "TextEdit"
tell app "Microsoft Entourage" to get item 1 of messages in folder 1
--> incoming message id 1 of application "Microsoft Entourage"
tell application "BBEdit 6.5" to the first item of the windows
--> text window 1 of application "BBEdit 6.5"
tell application "Microsoft Entourage" to get the first item of windows
--> window "Entourage" of application "Microsoft Entourage"
I have two further criticisms in this immediate context.
1. the 'all messages' thing is completely redundant. 'every
message' and 'messages' have always been synonymous in applescript
and it is this terminology that you should be using.
2. 'in' and 'of' when dealing with a list have always been
interchangeable, but not so in Mail.
the last item IN {1, 2, 3} is equal to the last item OF {1, 2, 3}
--> true
JD
_______________________________________________
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.