• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Script Menu or FastScript and paste
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Script Menu or FastScript and paste


  • Subject: Script Menu or FastScript and paste
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 02 Aug 2015 18:08:07 +0200

Hello

To insert my signature at the ned of my messages, I use a script.
In its "old" state, it was keystroking the signature.
Alas, in French August is spelled "août" and keystroking it inserts "aogt" which is annoying.

So I edited the script so that it paste the signature.

At this time, the code is

--{code}
on run
my germaine()
end run

on germaine()


set testSay to true
tell application "System Events" -- get frontmost process
set frontmostProcess to first process where it is frontmost -- this will be the script process
if name of frontmostProcess is in {"Script Editor", "AppleScript Editor"} then
set visible of frontmostProcess to false -- hide the script process
repeat while (frontmostProcess is frontmost) -- wait until the script is hidden
delay 0.2
end repeat
set theApp to name of first process where it is frontmost -- get name of frontmost process (ignoring the script process)
set frontmost of frontmostProcess to true -- unhide the script process
else
set theApp to name of frontmostProcess
end if
end tell
set theDate to current date


set leMessage to "Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) " & date string of theDate & space & time string of theDate


set oldClipBoard to the clipboard as record # save it to reset it on exit


tell application theApp
activate # changes nothing
set the clipboard to leMessage
if testSay then set inTheClipBoard to the clipboard as text
end tell
--delay 0.2 # changes nothing
tell application "System Events" to tell process theApp
set frontmost to true
keystroke "v" using {command down}
end tell
--end tell
set the clipboard to oldClipBoard # reset the original content


if testSay then say inTheClipBoard
end germaine

--=====
--{code}

I'm really puzzled. 
When I run it from the Script Editor, with TextEdit as target application, it works well.

When I run it from the Script Editor, with Mail as target application, orexecute it from the Script menu or trigger it thru Fastscripts, it pastes the original clipboard content BUT when testSay is set to true, it says my signature (leMessage)

Am I doing something wrong ?
Is it the normal behavior ?
Is it any chance that using ASObjC to fill the pasteboard will give what I want ?

Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) dimanche 2 août 2015 18:06:32

To insert the signature above, I ran the script from the editor with TextEdit as target then copied from TextEdit and pasted here, awful isn't it ?






 _______________________________________________
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

  • Follow-Ups:
    • Re: Script Menu or FastScript and paste
      • From: Shane Stanley <email@hidden>
    • Re: Script Menu or FastScript and paste
      • From: Yvan KOENIG <email@hidden>
    • Re: Script Menu or FastScript and paste
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: good ways of communicating info from AS with non-scriptable apps?
  • Next by Date: Re: Script Menu or FastScript and paste
  • Previous by thread: Re: good ways of communicating info from AS with non-scriptable apps?
  • Next by thread: Re: Script Menu or FastScript and paste
  • Index(es):
    • Date
    • Thread