Le 31 janv. 2010 à 23:34:37, Alan Kimelman a écrit :
Axel,
Your UI script solved the problem of sending an outgoing message that had been generated by Safari's applescript command to email contents.
Thank you for your help.
Along a similar vein, I am having difficulty changing the name of the subject in the outgoing message. The script you suggested, along with other attempts I have made to change outgoing message's subject, have failed to change the name.
The method employed by Safari applescript is to make the subject of the outgoing message the same text or value as the title of the HTML page in Safari . In your script example that would be N.
How might I find a method to change the subject in the outgoing message?
Mmm... I secretly hoped you wouldn't need to do that. ;-)
This is the kind of problematic access to the properties of an "external" outgoing message I alluded to in a previous mail. In fact, it is even surprising that "make new recipient..." works in that case.
Anyway, let's explore the UI items exposed by a window displaying an outgoing message; assuming that such a window is the frontmost in Mail, let's run:
tell application "System Events"
tell application process "Mail"
UI elements of front window
--> {..., text field "Objet :" of window "Re: Send outgoing message error from Mail.app" of application process "Mail" of application "System Events", ...}
end tell
end tell
Fine, it seems that the field of interest isn't deeply nested in some complicated window organization. After some experiments (and surprises - for example, the field can't be accessed by name):
tell application "Mail" to activate
tell application "System Events"
tell application process "Mail"
tell front window
tell text field 1
set focused to true
keystroke "Sample message object"
end tell
end tell
end tell
end tell
HTH,
Axel