Re: Is Mail scriptable ??
Re: Is Mail scriptable ??
- Subject: Re: Is Mail scriptable ??
- From: John Delacour <email@hidden>
- Date: Sat, 16 Nov 2002 23:03:34 +0000
- Mac-eudora-version: 5.3a9
At 11:59 am -0800 16/11/02, cricket wrote:
This is what I used to get the content of the message I'm currently
composing to you and the list:
tell application "Mail"
set theCurrentWindowTitle to name of front window
set theMessages to every outgoing message whose subject is
theCurrentWindowTitle
set theMessage to item 1 of theMessages
get content of theMessage
end tell
Not 100% safe, but it works.
That's nothing but a gamble. Yuo might have 3 messages titled "New
Message" and three others with the same subject.
We do need to wire up the window class to have a document property,
such that you can get the contents more easily than this. I'll make
sure we get it done.
You haven't explained how you get the contents of a RECEIVED message
in the front window, which is what I challenged you to do in 100
lines :-)
Why can't you just keep things simple like any other mailer. What
you seem to be proposing is that in a future version we write:
tell app "Mail" to get content of document in window 1
Not only is this totally unintuitive and verbose but it further
complicates an aete that is already completely chaotic.
Since things are so bad, why don't you just scrap the whole thing,
have a look at how other people do things and try to write an aete
that is at least just as good or preferably better? Even TextEdit is
marginally more rational but still completely out on a limb, but its
syntax is completely different from Mail's. At least one might
expect Apple to balls up both programs equally badly with the same
lousy syntax.
If I write this:
tell application "Mail"
set m to make outgoing message at end of outgoing messages
tell m
open
set its content to "hello"
end tell
end tell
I get an error:
tell application "Mail"
make at end of every outgoing message new outgoing message !!!!!
--> outgoing message id 28009056
open outgoing message id 28009056
<<event ascrgdut>>
--> {}
open outgoing message id 28009056
--> Mail got an error: outgoing message id 28009056 doesn't
understand the open message.
If I omit the open command, the script runs, but I can see no
evidence that any message has been created at all!
Instead, the only Mail script provided by Apple, the aptly-named
"Crazy Message Text.scpt" suggests that this is minimum required to
perform the most basic operation:
set this_message to make new outgoing message at end of outgoing
messages with properties {visible:true}
Mein Gott!!
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.