Basically, I have this script:
Code: Select all
string1 = {Numpad2}{Return}
string2 = {Numpad1}{Numpad4}{Return}
string3 = {Numpad1}{Numpad0}{Return}
Loop
{
Random, Var,1,3
Send, % string%Var%
Sleep,20000
}
Loop,
{
#Persistent
SetTimer, PressTheKey, 20000
Return
PressTheKey:
Send, {{Numpad2}{Return}}
Sleep, 20000
Send, {{Numpad1}{Numpad4}{Return}}
Sleep, 20000
Send, {{Numpad1}{Numpad0}{Return}}
Sleep, 20000
Return
}
What this script does is, that every 20 seconds, it randomly types either 2 followed by Enter keys or 14 followed by Enter keys or 10 followed by Enter keys.
So far so good.
I have the following questions:
1) At its' current state, the script I have runs indefinitely in a loop. Only way for me to stop it is either manually or by using Task Scheduler to shut down the PC after specific amount of time. I want the above loop to end after 1 hour or 2 or 3. Meaning, I want to be able to control how long the script runs.
2) At its' current state, when I run the script to test it, it works fine. However, with only Google Chrome being as the open and active window where the script is intended to run, sometime the Google Chrome becomes inactive on it's own. Meaning, that the script is just running on Desktop, where it has no affect or purpose. I'm not sure if this problem is caused by the script, but I want to be able to lock the script to only run on the active fully maximized active Google Chrome window.
3) I want each of the 3 strings above to be dependent on what is shown on the app in use.
For instance, using Chrome on my Windows 10 machine I want the script to do the following:
a) If a Web-page contains the word "summer" then execute "string1".
b) If a Web-page contains the word "winter" then execute "string2".
c) If a Web-page contains the word "autumn" then execute "string3".
4) Finally, the execution of the strings should, however, be dependent on two or more variables. For instance, if a Web-page contains either the word "autumn" or "spring" or "snowstorm" then execute "string3".
I hope you guys can help
Thank you!
Please note, I'm really new in to this, so please, do not assume I would understand everything, unless you explain