How to repeat the AHK recorded script to 10 tabs (or multiple tabs) with one keystroke

1

My works involves inputing at data repeatedly, so what I do I open as much as 10 tabs in the windows and repeat the input of information, same info to all the 10 tabs... so I used a recorder in AHK to help me input the data for each tab..... so I wonder if I can execute a command with a keystroke that will automatically fill the info to all 10 tabs at once...since the info. is all the same...below is my basic recorded script for one tab.

^!K::

MouseClick, left, 229, 142

send ZRDP-07-30-WEP.10/15-005

MouseClick, left, 460, 175

Sleep, 100

MouseClick, left, 319, 248

Sleep, 100

MouseClick, left, 470, 226

Sleep, 100

MouseClick, left, 258, 308

Sleep, 100

MouseClick, left, 468, 250

Sleep, 100

MouseClick, left, 252, 346

Sleep, 100

MouseClick, left, 464, 272

Sleep, 100

MouseClick, left, 252, 366

Sleep, 100

MouseClick, left, 1363, 211

Sleep, 100

MouseClick, left, 1232, 223

Sleep, 100

MouseClick, left, 1194, 275

Sleep, 100

MouseClick, left, 1134, 303

Sleep, 100

MouseClick, left, 1126, 152

Sleep, 100

Send, DD & KC

return

Below I have tried to repeat all the recorded script above to run or execute on the next tab,,. but with no success :(

^!K::

Var1 = ZRDP-07-kew.1/15-764

param =

{

MouseClick, left, 229, 142

send %var1%

MouseClick, left, 460, 175

Sleep, 100

MouseClick, left, 319, 248

Sleep, 100

MouseClick, left, 470, 226

Sleep, 100

MouseClick, left, 258, 308

Sleep, 100

MouseClick, left, 468, 250

Sleep, 100

MouseClick, left, 252, 346

Sleep, 100

MouseClick, left, 464, 272

Sleep, 100

MouseClick, left, 252, 366

Sleep, 100

MouseClick, left, 1363, 211

Sleep, 100

MouseClick, left, 1232, 223

Sleep, 100

MouseClick, left, 1194, 275

Sleep, 100

MouseClick, left, 1134, 303

Sleep, 100

MouseClick, left, 1126, 152

Sleep, 100

Send, DD & KC

}

Send, {CTRLDOWN}{TAB}{CTRLUP}

MouseClick, left, 229, 142

action =

return

Pls help me on this ... Thanks very much...

I think I may have found a part of the solution to my own question.. below is my script..

F9::

Var1 = ZRDP-07-kew.1/15-123

MouseClick, left, 229, 142

send %var1%

MouseClick, left, 460, 175

Sleep, 100

MouseClick, left, 319, 248

Sleep, 100

MouseClick, left, 470, 226

Sleep, 100

MouseClick, left, 258, 308

Sleep, 100

MouseClick, left, 468, 250

Sleep, 100

MouseClick, left, 252, 346

Sleep, 100

MouseClick, left, 464, 272

Sleep, 100

MouseClick, left, 252, 366

Sleep, 100

MouseClick, left, 1363, 211

Sleep, 100

MouseClick, left, 1232, 223

Sleep, 100

MouseClick, left, 1194, 275

Sleep, 100

MouseClick, left, 1134, 303

Sleep, 100

MouseClick, left, 1126, 152

Sleep, 100

Send, DD & KC

Send, {CTRLDOWN}{TAB}{CTRLUP}

sendinput, {F9}

return

However this command will executed non stop.. as sendinput {F9} will go on forever... How do I limit this sendinput say only up to 10 tabs(windows browser)... pls advice. Thanks You.

Sonyxmarko

Posted 2015-01-11T02:32:43.953

Reputation: 11

1I think you need to tell what goes wrong, how it does not work? what happens and where it fails or ends or what error it gives? – Psycogeek – 2015-01-11T02:47:10.493

first of all thanks very much for your respond...I am positive if you only can show me how to make all the recorded script to execute or repeat on the next windows tab (with one keystroke)... I am sure that will solve the problem... above I have shown you my first recorded script/command for my first windows, so basically I just wanted it to repeat for the following 10 tabs... but I don't know how to make it repeat with one keystrokes up to 10 windows tab. I hope you understand. Thanks very much. – Sonyxmarko – 2015-01-12T12:33:36.370

basically, I need to input the same information on the next windows tab and so on, the problem that after finish with the first tab it won't go to the next tab and repeat the same procedure. I just need the correct syntax that will do the repeating on next tab.tnx.. – Sonyxmarko – 2015-01-12T12:47:21.307

What do you mean by "Windows tab"? Do you mean in your web browser? Most of the time, you can navigate web browser tabs using "Ctrl + PageDown" to go to the next one (and "Ctrl + PageUp" to go to the previous). Will sending that keystroke work for you? – Moshe Katz – 2015-01-13T04:23:22.413

Yes I mean web browsers,.. I also used ctrl + tab to navigate between windows tab or web browser... however I sometimes open up to 10 tabs for inputting the same information over and over again. I mean for example Task 1 got like 30 items, and Task 2- 50 item. Task 3 - 25, Task 4 - 15 and so on. so as my humble request I just want to know what is the correct syntax or command so that I can make my recorded scripts to repeat automatically to the next tabs (or web browser) – Sonyxmarko – 2015-01-16T11:34:04.420

Good day, I have found a solution to this with the below script. – Sonyxmarko – 2015-01-16T15:30:31.303

Answers

0

You should NOT use macro shortcut-key (F9) in your script. If do so it always call itself and your script will not finish. try this way:

; your macro shortcut key is pressed
F9::
step := 0
; a variable named 'step' is defined and initialized to 0

;here is the start of your action which should be repeated 10 times
start:

;;;;;;;; PUT YOUR CODES HERE

Var1 = ZRDP-07-kew.1/15-123

MouseClick, left, 229, 142

send %var1%

MouseClick, left, 460, 175

Sleep, 100

MouseClick, left, 319, 248

Sleep, 100

MouseClick, left, 470, 226

Sleep, 100

MouseClick, left, 258, 308

Sleep, 100

MouseClick, left, 468, 250

Sleep, 100

MouseClick, left, 252, 346

Sleep, 100

MouseClick, left, 464, 272

Sleep, 100

MouseClick, left, 252, 366

Sleep, 100

MouseClick, left, 1363, 211

Sleep, 100

MouseClick, left, 1232, 223

Sleep, 100

MouseClick, left, 1194, 275

Sleep, 100

MouseClick, left, 1134, 303

Sleep, 100

MouseClick, left, 1126, 152

Sleep, 100

Send, DD & KC

Send, {CTRLDOWN}{TAB}{CTRLUP}

;;;;;;;; END OF YOUR CODES [without 'RETURN']

; adding current step to number of total passed steps
step := step " + 1"

; simply check to see if current step is lower than 10 times or not
If step <= 10
{
    ; if so repeat your codes
    Goto, start
}
return

Mojtaba Rezaeian

Posted 2015-01-11T02:32:43.953

Reputation: 323