Hi,
Looking for a script which does the following..
F5 Key then a second later press the enter key.
This must be on a 2 minute interval.
Thanks!
Script request.
-
- Posts: 1
- Joined: 23 Feb 2018, 05:06
Re: Script request.
Code: Select all
#NoEnv
#Persistent
gosub, spam
SetTimer, spam, 120000
return
spam:
Send, {F5}
Sleep, 1000
Send, {Enter}
return
Re: Script request.
Question. Won't the gosub redirect to the label spam every persistent? Or does the gosub disable after it hits a return?Xtra wrote:Code: Select all
#NoEnv #Persistent gosub, spam SetTimer, spam, 120000 return spam: Send, {F5} Sleep, 1000 Send, {Enter} return
I am your average ahk newbie. Just.. a tat more cute.
Re: Script request.
The gosub only runs one time. The timer is left running when the return is reached.
Re: Script request.
What if gosub is under a hotkey? or a label? Ah I tried and it does work under a hotkey, more than once. But then why does it trigger only once under persistent which is supposed to run the script infinitely many times right? Oh is it because the settimer thread is still running? But then what is the point of persistent in the script at all??Xtra wrote:The gosub only runs one time. The timer is left running when the return is reached.
I am your average ahk newbie. Just.. a tat more cute.
Re: Script request.
#Persistant makes the script not exit.
From the docs:
HTH
From the docs:
Gosub only runs once because it was put in the auto-execute section.If this directive is present anywhere in the script, that script will stay running after the auto-execute section (top part of the script) completes. This is useful in cases where a script contains timers and/or custom menu items but not hotkeys, hotstrings, or any use of OnMessage() or Gui.
When in doubt check the docs.The Top of the Script (the Auto-execute Section)
After the script has been loaded, it begins executing at the top line, continuing until a Return, Exit, hotkey/hotstring label, or the physical end of the script is encountered (whichever comes first). This top portion of the script is referred to as the auto-execute section.
A script that is not persistent and that lacks hotkeys, hotstrings, OnMessage, and GUI will terminate after the auto-execute section has completed. Otherwise, it will stay running in an idle state, responding to events such as hotkeys, hotstrings, GUI events, custom menu items, and timers.
HTH
Who is online
Users browsing this forum: No registered users and 95 guests