Mail GUI scripting broken?
Mail GUI scripting broken?
- Subject: Mail GUI scripting broken?
- From: email@hidden
- Date: Sun, 11 Oct 2009 17:42:09 +0200
On 10.6.1 I try to get the text selection from Mail into the
clipboard. With GUI scripting I get very strange behavior. The script
at the bottom was the only form I could get it to work. I believe I
made no mistake, so I think Mail is the culprit here?
In OS X' Services menu there's an entry (if text is selected) "New
Email with selection". Does anybody know how that one gets the
selected text? Are they doing GUI scripting in the background? :-DDD
Christian
------------------------
--GUI scripting, Mail's text selection into clipboard:
tell application "System Events"
tell process "Mail"
--set frontmost of application "Mail" to true -- doesn't come to front
--set frontmost of application "Finder" to true -- comes to front
and get's the Finder's selection, although the Finder isn't targeted
in 'tell process'.
tell application "Mail" to activate -- doesn't work at all without.
delay 0.5 -- doesn't work at all without.
--delay 2 -- things are better? No.
--keystroke "c" using command down -- doesn't work (clipboard
unchanged).
--keystroke "c" using command down -- doing this two times works on
every second attempt. After about 3 tries the statement 'the clipboard
as record' errors with "An error of type -25131 has occurred.".
--Choosing 'Copy' from the Edit menu:
click menu item 5 of menu 4 of menu bar 1 -- doing this just 1 time
doesn't work most of the time (clipboard is unchanged). Update: Now
work on every second attempt (just like the 'press command-c two
times').
click menu item 5 of menu 4 of menu bar 1 --doing it two times seems
to work all the time.
end tell
end tell
tell me to activate -- just to return to Script Debugger
the clipboard as record --> errors sometimes with "An error of type
-25131 has occurred."
return «class utf8» of result
------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden