I have a set of shortcuts I use to copy/paste data from one application to the other. While coding these shortcuts in a script is a piece of cake, I don't know how to make the script change the focus from one application to another.
Since the process is very similar to copy/paste sentences from a text and translate them one by one with Google Translate, I've looked up if someone had written such script but I couldn't find one. Let's see:
a) Application A:
Ctrl+A ; select the content of a box where the cursor is
Ctrl+C ; copy the content to clipboard
b) Go to App B (which contains two boxes, at left the box where the data should be pasted and at right the box where App B will put the data after processing it)
Ctrl+A ; select the content of left box
Del ; delete the existing content (needless, Ctrl+V will delete it anyway)
Ctrl+V ; paste the content from clipboard
c) At this point App B takes the content of left box, processes the data and, after 1 or 2 seconds, returns the result in right box.
Tab ; move the focus from left box to right box
Ctrl+A ; select the content of right box
Ctrl+C ; copy the content to clipboard
d) Go back to App A
Ctrl+A ; select the content of box
Del ; delete the existing content (needless, Ctrl+V will delete it anyway)
Ctrl+V ; paste the content from clipboard
One problem is the cursor position in App B. When going to step b) there should be a way to place the cursor on left box. Could you help me please?
commands to exchange data between applications
commands to exchange data between applications
Last edited by gregster on 27 Nov 2021, 13:45, edited 1 time in total.
Reason: Topic moved from 'Scripts and Functions'.
Reason: Topic moved from 'Scripts and Functions'.
Re: commands to exchange data between applications
I would try WinActivate or ControlFocus. An alternative may be ControlSetText-- easier if that works. I also recommend ClipWait when you set your clipboard.