I am trying to create a script that copies the fields in a form on one window to a form on another window using Alt-Tab to move between the windows.
The first alt-tab works to move from window 1 to window 2 but the next alt-tab to move from window 2 to window 1 doesn't work.
My script is as follows:
#z::Send ^c!{tab}^v!{tab}{tab}^c!{tab}{tab}^v!{tab}{tab}^c!{tab}{tab}^v!{tab}
On pressing Window z I want it to copy the current field in window 1, move to window 2 and paste it, then move back to window 1 and copy the next field, move to window 2 and paste into the next field and so on.
Can anyone help.
Thanks
Best Answer
I haven't found sending string of keystrokes to be very effective in this type of circumstance. There are too many different ways it could go wrong. I'd try to use the built in clipboard variables and only swap between windows once.
You can use a hotkey to do a set of instruction using this format in your script:
I would grab the data from the first form all at once and store it:
Once you've gotten the data from the first window, you can move to the next window:
(Although a better method is WinActivate.)
On the second window, you can move down the form, inserting data from the first:
See AutoHotKey's page for Clipboard Variables for reference.