Thursday, July 9, 2020
  • Index
  •  » Automator
  •  » Paste text to last active window (floating/panel)

#1 2020-05-04 10:39:27 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Paste text to last active window (floating/panel)

Hello,

I have created a workflow as system service that calculates some data and pastes them in clipboard.

Then when recalled, it pastes them to the app's window where it was recalled from.

At the moment I'm running this AppleScript code to achieve the task:

Applescript:


tell application "System Events"
tell (first application process whose frontmost is true)
set active_name to name of it
end tell
set Name_App to item 1 of (get name of processes whose frontmost is true)
end tell
tell application active_name
activate

tell application "System Events" to tell process(active_name) to keystroke "v" using command down

end tell

It works in most of apps, however I'm experiencing some problems with this approach.

In the apps with floating windows/panels it is not pasted to the correct window where the service was recalled from.

I tried also this:


Applescript:


tell application "System Events"
set frontmost of process "active_name" to true
keystroke "v" using command down
end tell

without luck.

Could you please help?  Thanks.

Last edited by epaminos (2020-05-04 10:40:52 am)

Offline

 
  • Index
  •  » Automator
  •  » Paste text to last active window (floating/panel)

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)