soheill0098 wrote: ↑09 Aug 2021, 17:45
But I set loop count 8 for the script but sometimes there are less or more opened tabs that I want to save. So every time I should open the script and change the number 8 to the number I want and reload the script.
I wonder is it possible to add some lines of script to it so that every time I run the script it ask me for number of iterations (loop count) that I want the program perform the loop? (for example by showing a box and I type the loop number in the box.)
I'm not sure why its not running all 8 times. In my experience, loops will execute until something melts or the loop finishes execution.
Try an input box. I had a very similar issue except I had to use an
.ini file to pass the loop number variable between scripts.
Code: Select all
Inputbox, [Your Var here], give me the number of times to loop.
[In the following section of code]
#SingleInstance,force
^!e::
loop,%[Your Var Here]%
^!a::
sleep,300
send,^p
sleep,5000
click,155,746
sleep,5000
send,{Enter}
sleep,1000
send,^w
sleep,2000
}
Esc:: ExitApp
return
-Untested-
Input box sounds like your way forward.
https://www.autohotkey.com/docs/commands/InputBox.htm - AHK help document.
You can pull out the variable you write into the inputbox by enclosing the variable name you used previously in percent signs %%
Remember that when you declare the variable in the inputbox command line you have to use the same variable name in your
Loop counter, IE
Code: Select all
Inputbox, MyVariable, Give me the # of Loops!
Loop,%MyVariable%
; looping...
If you don't want to be prompted to write a new value in each time I'd think the solution would be to simply write the integer, as the number of loops, in the loop command line...
For example.
Good luck!