please help on loop issue Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
gohogoh

please help on loop issue  Topic is solved

01 Aug 2018, 08:38

Hi huys,

i have read tutorials on doing loop, but seem like it doesn't work


my script is

Code: Select all


Send, {tab} 
Send ^{a}
Sleep, 3500
Send, xxxxxxxxxxxxxxxxxxx
Send, {enter}
Send, yyyyyyyyyyyyyyyyyyy
Send !{enter}
Sleep, 8000 

Send, {tab} 
Send ^{a}
Sleep, 3500
Send, xxxxxxxxxxxxxxxxxxxxxxxxxxx
Send, {enter}
Send, yyyyyyyyyyyyyyyyyyyyyyyyyyy
Send !{enter}
Sleep, 8000 

Send, {tab} 
Send ^{a}
Sleep, 3500
Send, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Send, {enter}
Send, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Send !{enter}
Sleep, 8000 

.
.
.
.
.
.
.
.
.
.
Send, {tab} 
Send ^{a}
Sleep, 3500
Send, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Send, {enter}
Send, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Send !{enter}
Sleep, 8000 

whereas i have 2 data sets which are
[x, xx, xxx, ..............., xxxxxxxxxxxxxxxx]
[y, yy, yyy, ..............., yyyyyyyyyyyyyyyyy]


and i would like it to run continuoslyy

anyone that have experience with loop please helppp


Your help is greatly appreciate :)
Vh_
Posts: 201
Joined: 17 Mar 2017, 22:06

Re: please help on loop issue

02 Aug 2018, 21:14

Loop ;5 specify an amount, or just let it be an infinite loop.
{
Msgbox, Check the loop command in the tutorial. Also, press escape to exit this script. :)
}

Escape::ExitApp
hunter99
Posts: 128
Joined: 20 Jan 2014, 17:57

Re: please help on loop issue

02 Aug 2018, 23:48

Hi gphogoh,
don't really know what you are trying to do, but your code looks like it sends a "tab" then a "control a", a 3.5 second sleep, a "x", a newline, a "y", a "!" and a newline, lastly a 8 second sleep.
It looks like you want a loop that for each iteration the x and y count rise by 1.
Try this, I shortened it up a bit, along with the sleeps to see it better on notepad.

You may find this very helpful:
Get a copy of CodeQuicktester by GeekDude from here:

https://autohotkey.com/boards/viewtopic.php?f=6&t=6113

hunter99
Edit 9:17 AM 8/3/2018 to clean up notes

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;get a copy of CodeQuicktester by GeekDude from here:
;https://autohotkey.com/boards/viewtopic.php?f=6&t=6113

;Make notepad active and click h and get a row of 50 x's,
;and a row of 50 y's ending with a !. Then a Lf/CR

h::               ; key to use for testing
loop, 50         ; remove the 50 to run continuous, used 50 for testing
 {                ; start of loops code block
   Send, {tab}    ; send one "tab"
   Send ^a        ; send a shortcut key, the control key and letter "a"
   Sleep, 50      ; sleep approx. 50 milli sec.,  used 50 for testing
   Send, {x %A_Index%}{enter}      ; sends letter "x" times the number in A_Index
                               ; then sends Enter key which gives a Lf/CR
   Send, {y %A_Index%}{!}{enter}     ; sends letter "y" times the number in A_Index
                               ; then sends letter "!" and Enter key which gives a Lf/CR

   ; OP was using "Send, !{enter}" after sending the y's   
   ; sends the alternate key (no idea why) and Enter key which then does nothing
   ; but there may be a shortcut key " ! + Enter in the program the script is used with 

   Sleep, 100     ; sleep approx. 100 milli sec. , used 100 for testing
 }                ; end of loops code block
return            ; return for another key hit

Escape::ExitApp

Return to “Ask For Help”

Who is online

Users browsing this forum: Gedzas, TAC109 and 33 guests