aspire7551 Posted February 8, 2012 Share Posted February 8, 2012 Hi im new the autoit and programming in general. What I'm trying to do is make the mouse move to a certain location and type in a series of keys over and over again but in a different combination every time. This is what i have so far. I would like to make it so it types in 1 then finishes the function then the second time around it types 2 then 3 then 4 and the numbers just keep going up. I want to enter the number where it says ;;;; HERE ;;;; Any help would be much appreciated thank you. HotKeySet("{F4}", "ExitProg") HotKeySet("{F5}", "StartProg") While 1 Sleep(100) Wend Func StartProg() while 1 mousemove(775,300) MouseClick("left") MouseClick("left") Send ("{BACKSPACE}") ;;;; HERE ;;;; Send ("{ENTER}") Sleep(1400) WEnd EndFunc Func ExitProg() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2012 Share Posted February 8, 2012 This should work just fine. HotKeySet("{F4}", "ExitProg") HotKeySet("{F5}", "StartProg") While 1 Sleep(100) Wend Func StartProg() while 1 mousemove(773,193) MouseClick("left") MouseClick("left") Send ("{BACKSPACE}") For $i = 0 to 20 ; << enter the start Number and the end Number Local $StringSp = StringSplit ( $i, "" ) For $III = 1 To $StringSp[0] Send ("{"&$StringSp[$III]&"}") Next Next Send ("{ENTER}") Sleep(1000) WEnd EndFunc Func ExitProg() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
aspire7551 Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) I ran the script and it just types a random amount of random numbers every time. I vaguely remember this from school and there was a variable with a value of 0 and in the function 1 would be added to it and then when the function started again the value of that variable would now be 1 and then the function would add 1 more, then 2 and so forth. maybe something like $i = $i + 1 Edited February 8, 2012 by aspire7551 Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2012 Share Posted February 8, 2012 May be this will work for you. Global $Ver = 0; << enter the start Number HotKeySet("{F4}", "ExitProg") HotKeySet("{F5}", "StartProg") While 1 Sleep(100) Wend Func StartProg() While 1 Mousemove(773,193) MouseClick("left") MouseClick("left") Send ("{BACKSPACE}") Local $StringSp = StringSplit ( $Ver, "" ) For $III = 1 To $StringSp[0] Send ("{"&$StringSp[$III]&"}") Next Send ("{ENTER}") $Ver += 1 Sleep(1400) WEnd EndFunc Func ExitProg() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2012 Share Posted February 8, 2012 maybe something like $i = $i + 1A more elegant way would be like this $Ver += 1 Link to comment Share on other sites More sharing options...
aspire7551 Posted February 8, 2012 Author Share Posted February 8, 2012 May be this will work for you. Global $Ver = 0; << enter the start Number HotKeySet("{F4}", "ExitProg") HotKeySet("{F5}", "StartProg") While 1 Sleep(100) Wend Func StartProg() While 1 Mousemove(773,193) MouseClick("left") MouseClick("left") Send ("{BACKSPACE}") Local $StringSp = StringSplit ( $Ver, "" ) For $III = 1 To $StringSp[0] Send ("{"&$StringSp[$III]&"}") Next Send ("{ENTER}") $Ver += 1 Sleep(1400) WEnd EndFunc Func ExitProg() Exit 0 EndFunc Thank you very much =) one more thing. How can i make it save all the numbers its typed into a .txt file once the program is stopped or it finishes 1 loop or every 10 loops? Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2012 Share Posted February 8, 2012 (edited) Thank you very much =) one more thing. How can i make it save all the numbers its typed into a .txt file once the program is stopped or it finishes 1 loop or every 10 loops? When it finishes 1 loop it will write to file. Global $Ver = 0; << enter the start Number HotKeySet("{F4}", "ExitProg") HotKeySet("{F5}", "StartProg") While 1 Sleep(100) Wend Func StartProg() $FileHen = FileOpen(@ScriptDir&"textfile.txt",1) While 1 Mousemove(773,193) MouseClick("left") MouseClick("left") Send ("{BACKSPACE}") Local $StringSp = StringSplit ( $Ver, "" ) For $III = 1 To $StringSp[0] Send ("{"&$StringSp[$III]&"}") Next Send ("{ENTER}") $Ver += 1 FileWrite($FileHen,$Ver) Sleep(1400) WEnd FileClose($FileHen) EndFunc Edited February 8, 2012 by Guest Link to comment Share on other sites More sharing options...
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