More Mail fun
More Mail fun
- Subject: More Mail fun
- From: John Delacour <email@hidden>
- Date: Mon, 11 Aug 2003 00:16:40 +0100
A window in Mail has no useful properties. It has the 'document'
property, but this is 'missing value' because Mail has no documents.
A message cannot be referred to in any useful way, has no 'id'
property as such and no 'window' property. A newly created 'outgoing
message' is given a unique id, but this serves no purpose once the
message is saved. Once it is saved it does not exist. The thing
that was saved might be said to exist but that is not certain
tell application "Mail"
close windows
repeat with i from 1 to 5
set p to {visible:true, subject:"message_" & i}
set m to make outgoing message with properties p
save m
close front window
end repeat
count outgoing messages
end tell
--> 0
Here's another interesting script. The results are more interesting
if you try and work out waht actually happens, for example by
switching to another mailbox and back to drafts, with and without the
message window (sorry, messages don't have windows, but you know what
I mean!) open. I'm looking forward to a few new mail classes such as
'thin air' and 'fairy grotto'.
tell application "Mail"
close every window
set _viewer to make message viewer
set _id to _viewer's id
set p to {visible:true, subject:"Original"}
set m to make outgoing message with properties p
save m
set bounds of window 1 to {40, 40, 400, 400}
set _viewer to first message viewer whose id is _id
set selected mailboxes in _viewer to {drafts mailbox}
set visible messages in _viewer to {last message in drafts mailbox}
set _msg to last message in drafts mailbox
tell _msg
set its subject to "Changed"
end tell
end tell
_______________________________________________
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.