MrCooxie Posted October 23, 2021 Posted October 23, 2021 Hello everyone! I am very new to this forum (first post ever). And i really want to make a program that: Has a start button and end button, it works endlessly until stop button is pressed. The program needs to always press lets say "a" then after a has been pressed for around 20 seconds then it will like "s" and around another 20seconds it will not press "s" anymore and will start to press "d". Since I am really new to autoit i basically don't know anything, but I have learned some other coding language. If anyone could give me a hint or where to find the solution or give a simple examlpe of similar program, then that would be great. Thanks everyone - MrCooxie
Werty Posted October 23, 2021 Posted October 23, 2021 29 minutes ago, MrCooxie said: Hello everyone! "a" "s" "d". Thanks everyone - MrCooxie What about "w" ? Incase you missed it, talk about game automation is not allowed here, according to forum rules. Some guy's script + some other guy's script = my script!
AlessandroAvolio Posted October 24, 2021 Posted October 24, 2021 4 hours ago, MrCooxie said: Hello everyone! I am very new to this forum (first post ever). And i really want to make a program that: Has a start button and end button, it works endlessly until stop button is pressed. The program needs to always press lets say "a" then after a has been pressed for around 20 seconds then it will like "s" and around another 20seconds it will not press "s" anymore and will start to press "d". Since I am really new to autoit i basically don't know anything, but I have learned some other coding language. If anyone could give me a hint or where to find the solution or give a simple examlpe of similar program, then that would be great. Thanks everyone - MrCooxie While, Send(), Sleep(), GuiCreate(), GUICtrlCreateButton(), Switch, TimerInit(), TimerDiff(), Exit. Search one of these on Google. Find the reference. Type function name in Scite Editor, move mouse cursor on it and press F1 to read reference with examples.
Comatose Posted October 25, 2021 Posted October 25, 2021 What you're asking is basic scripting. You have even posted your pseudo code. You just need to learn the commands to do just that.
junkew Posted October 25, 2021 Posted October 25, 2021 Read the help file, faq and start coding your answer is in this page of the help file https://www.autoitscript.com/autoit3/docs/functions/ https://www.autoitscript.com/autoit3/docs/functions/Send.htm https://www.autoitscript.com/autoit3/docs/functions/Sleep.htm FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
ad777 Posted December 3, 2021 Posted December 3, 2021 On 10/23/2021 at 10:12 PM, MrCooxie said: Hello everyone! I am very new to this forum (first post ever). And i really want to make a program that: Has a start button and end button, it works endlessly until stop button is pressed. The program needs to always press lets say "a" then after a has been pressed for around 20 seconds then it will like "s" and around another 20seconds it will not press "s" anymore and will start to press "d". Since I am really new to autoit i basically don't know anything, but I have learned some other coding language. If anyone could give me a hint or where to find the solution or give a simple examlpe of similar program, then that would be great. Thanks everyone - MrCooxie hope this help you☺️ expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Global $status = "stopped",$dl = "on" Global $num,$num2,$num3 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 505, 449, 192, 114) $Input1 = GUICtrlCreateInput("Input1", 360, 384, 121, 21) $startbutton = GUICtrlCreateButton("Start", 72, 384, 73, 33) $stopbutton = GUICtrlCreateButton("Stop", 176, 384, 73, 33) $Edit1 = GUICtrlCreateEdit("", 24, 16, 441, 353) GUICtrlSetData(-1, "Edit1") GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate") GUICtrlSetOnEvent($startbutton, "StartButton") GUICtrlSetOnEvent($stopbutton, "StopButton") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 if $status = "started" Then;;it check if $status = "started" _SetCharG("a","s","d");;it will type "a" for 20 sec & next it will type "s" for 20 sec ..&&. ;;;;; EndIf ;;;;;; $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(300) WEnd Func _SetCharG($char1,$char2,$char3) if $dl = "on" Then;;;if dl = "on" <- we use it to define if it's "a" Local $chr;;local $chr (variable) $num = $num + 1;;$num = it incr every time by 1 $chr = $chr & $char1;:$chr = it incr every time by "a" GUICtrlSetData($Edit1,$chr,1);;it will print "a" in Edit1 dialog GUICtrlSetData($Input1,$num);;;it will print secound in input dialog EndIf if $dl = "on2" Then;if dl = "on2" <- we use it to define if it's "s" Local $chr2;;local $chr2 (variable) $chr2 = $chr2 & $char2;:$chr2 = it incr every time by "a" $num2 = $num2 + 1;;$num2 = it incr every time by 1 GUICtrlSetData($Edit1,$chr2,1);;it will print "s" in Edit1 dialog GUICtrlSetData($Input1,$num2);;;it will print secound in input dialog EndIf if $dl = "on3" Then ;if dl = "on3" <- we use it to define if it's "d" Local $chr3;;local $chr3 (variable) $chr3 = $chr3 & $char3;:$chr3 = it incr every time by "d" $num3 = $num3 + 1;;$num3 = it incr every time by 1 GUICtrlSetData($Edit1,$chr3,1);;it will print "a" in Edit1 dialog GUICtrlSetData($Input1,$num3);;;it will print secound in input dialog EndIf if GUICtrlRead($Input1) = 20 Then;;if $input equal to 20 then do ... if $num2 = 20 Then;;if num 2 = 20 Then $dl = "on3" EndIf if $num = 20 Then $dl = "on2" $num = 0 EndIf if $num3 = 20 Then $num3 = 0 EndIf ;;;;if you want to incr something you can incr example: ;;;; GUICtrlSetData($Input1,0);;it will type 0 after 20 is finished.. EndIf EndFunc Func Terminate() Exit EndFunc Func StartButton() $status = "started" EndFunc Func StopButton() $status = "stopped" ;~ Exit EndFunc none
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now