Sign in to follow this  
Followers 0
aspire7551

Help with script

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by aspire7551

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

maybe something like $i = $i + 1

A more elegant way would be like this $Ver += 1

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by Aipion

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0