Normal, just after posting my question I made some progress.
When TextEdit was the target application, the evens log showed :
tell application "Script Editor" the clipboard as record end tell tell application "TextEdit" activate set the clipboard to "Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) dimanche 2 août 2015 18:06:32" the clipboard as text end tell tell application "System Events" set frontmost of process "TextEdit" to true keystroke "v" using {command down} end tell
but when it was Mail, it showed :
tell application "Script Editor" the clipboard as record end tell tell application "Mail" activate set the clipboard to "Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) dimanche 2 août 2015 18:11:35" the clipboard rule type rich text end tell tell application "System Events" set frontmost of process "Mail" to true keystroke "v" using {command down} end tell
So I understood that according to the environment, the clipboard instructions were treated differently. I decided to enclose the clipboard instructions in the tell application "System Events" block.
Now, when the script is called from the Editor, it behaves correctly with the different target applications.
Alas, no change when it is called from the Scripts menu or thru FastScripts.
Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) dimanche 2 août 2015 18:31:55
This time the signature was inserted by the script ran by the Editor. Far from comfortable but less boring than ten minutes ago.
|