How to make text appear every 20 minutes Topic is solved
How to make text appear every 20 minutes
Hi, I was wondering how to make a script that every 20 minutes presses t, types "/play bedwars_eight_one"(no quotes), and then presses enter
Thanks in advance
PS: I know this is probably very simple but I am a noob at this
Thanks in advance
PS: I know this is probably very simple but I am a noob at this
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: How to make text appear every 20 minutes
This can be done using the SetTimer method https://autohotkey.com/docs/commands/SetTimer.htm
So since we have a timer that we want to go off every 20 minutes we will start with converting minutes to milliseconds.
20 * 60 * 1000
This will be the time interval that we set the timer to go off since SetTimer wants the input in milliseconds.
Next is the variable you want to send, which can be done like this
Even though I have surrounded it with quotes note that it will not send the quotes with it.
Now to bring everything together (you can do this with a label but I used a hotkey instead)
Fyi I did not test this.
So since we have a timer that we want to go off every 20 minutes we will start with converting minutes to milliseconds.
20 * 60 * 1000
This will be the time interval that we set the timer to go off since SetTimer wants the input in milliseconds.
Next is the variable you want to send, which can be done like this
Code: Select all
string := "/play bedwars_eight_one"
Now to bring everything together (you can do this with a label but I used a hotkey instead)
Code: Select all
SetTimer, Controlt, (20 * 60 * 1000)
string := "/play bedwars_eight_one"
Return
^t::
SendInput, t
Send, %string%
Send {Enter}
Return
Last edited by MannyKSoSo on 27 Aug 2018, 13:56, edited 1 time in total.
Re: How to make text appear every 20 minutes
Thank you very much I have one question do I put string := "/play bedwars_eight_one" at the top of the second script you posted or run it as a separate ahk script with no other code?
Thanks again
Thanks again
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: How to make text appear every 20 minutes
yup, you can put it anywhere before the hotkey runs
Re: How to make text appear every 20 minutes
I tried this and there was an error on the second line that target label does not exist here is a link to the error message: https://youtu.be/0j90zA9r_HkMannyKSoSo wrote:This can be done using the SetTimer method https://autohotkey.com/docs/commands/SetTimer.htm
So since we have a timer that we want to go off every 20 minutes we will start with converting minutes to milliseconds.
20 * 60 * 1000
This will be the time interval that we set the timer to go off since SetTimer wants the input in milliseconds.
Next is the variable you want to send, which can be done like thisEven though I have surrounded it with quotes note that it will not send the quotes with it.Code: Select all
string := "/play bedwars_eight_one"
Now to bring everything together (you can do this with a label but I used a hotkey instead)Fyi I did not test this.Code: Select all
SetTimer, Controlt, (20 * 60 * 1000) string := "/play bedwars_eight_one" Return ^t:: SendInput, t Send, %string% Send {Enter} Return
Thanks Again
Re: How to make text appear every 20 minutes
I realise now that I wrote it wrong and %string% should only be defined once but even after I fixed that it still did not work (same error) except now on line 1
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: How to make text appear every 20 minutes
Set ^t to Controlt and it should work
Re: How to make text appear every 20 minutes
So just to be clear do you define ^t like this Controlt := ^t or like this ^t := Controlt ?
Thanks
Thanks
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: How to make text appear every 20 minutes
Code: Select all
SetTimer, Controlt, (20 * 60 * 1000)
string := "/play bedwars_eight_one"
Return
Controlt:
SendInput, t
Send, %string%
Send {Enter}
Return
Re: How to make text appear every 20 minutes
Sorry Again but there is still an error: https://imgur.com/a/BkfvjeUMannyKSoSo wrote:Code: Select all
SetTimer, Controlt, (20 * 60 * 1000) string := "/play bedwars_eight_one" Return Controlt: SendInput, t Send, %string% Send {Enter} Return
-
- Posts: 440
- Joined: 28 Apr 2018, 21:59
Re: How to make text appear every 20 minutes Topic is solved
Code: Select all
SetTimer, Controlt, 1200000
string := "/play bedwars_eight_one"
Return
^t::
Controlt:
SendInput, t
Send, %string%
Send {Enter}
Return
Re: How to make text appear every 20 minutes
Thank you very very much I tested this with a ten second delay and it works
- AfterLemon
- Posts: 85
- Joined: 30 Sep 2013, 14:27
- Location: Ohio, USA
Re: How to make text appear every 20 minutes
Quick clarification as to the issue seen in the last few comments:
will not work because SetTimer is a command and requires string inputs.
You can force expression syntax by using a parenthesis like
This evaluates 20*60*1000 to 1200000.
Code: Select all
SetTimer, Controlt, (20 * 60 * 1000)
You can force expression syntax by using a parenthesis like
Code: Select all
SetTimer, Controlt, % (20 * 60 * 1000)
HOME: Windows 11 Pro | AMD Ryzen 7 5800X 8-Core @ 4.50GHZ | 64GB RAM
MOBILE: Samsung Galaxy Note 10+
MOBILE: Samsung Galaxy Note 10+