System Events -- Differences in behavior calling from a menu and calling from SE
System Events -- Differences in behavior calling from a menu and calling from SE
- Subject: System Events -- Differences in behavior calling from a menu and calling from SE
- From: David Rouse <email@hidden>
- Date: Mon, 17 Jan 2005 19:40:24 -0500
I've got a script that uses system events to work around a bug in
Mail.app, I'm telling Mail.app to command+option+p to display the plain
text alternative before capturing the content of the message and
sending it to a text editor.
Here is a snippit of the script:
tell application "Mail"
activate
-- Gives us a list with the identifier for each message
set theMessages to selection
if the (count of theMessages) > 0 then
repeat with i from 1 to (count of theMessages)
open (item i of theMessages)
tell application "System Events"
tell process "Mail"
-- delay 1
keystroke "p" using {command down, option down}
end tell
end tell
set the_text to the content of (item i of theMessages)
set the_name to "From email -- " & subject of (item i of
theMessages)
set fromWho to sender of (item i of theMessages)
set whenSent to date sent of (item i of theMessages)
tell application "NewsEditPro" ...
When run from the script editor it works as expected, the message
changes to plain text and the text editor gets the message. But when I
run the script from the Mail's script menu the change to plain text
happens *after* Mail.app tries to send the text to the editor.
Any reason why this should be?
Thanks,
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden