How to create your own bots/macros with AutoIt

01/19/2007 10:25 BlackRaptor2#31
Nice work, it reaqlly helped me, i was lost for a while untill i read this +1k
01/19/2007 23:05 zeroRooter#32
Quote:
Originally posted by spoonieluv97@Jan 6 2007, 21:15
Any questions? It took me a while to write this :(
ya umm how do i determine my mouse posiotion. lets say i wanna click ie then how do i determine where the mouse postion is for ie on my desktop.
01/20/2007 00:45 spoonieluv97#33
Quote:
Originally posted by zeroRooter+Jan 19 2007, 23:05--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (zeroRooter @ Jan 19 2007, 23:05)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin--spoonieluv97@Jan 6 2007, 21:15
Any questions? It took me a while to write this :(
ya umm how do i determine my mouse posiotion. lets say i wanna click ie then how do i determine where the mouse postion is for ie on my desktop. [/b][/quote]
Theres a program called MacroExpress, and inside that program there is a little tool that is very handy. Where ever you mouse is, it tells you the coordinates of your mouse in that window, on the whole screen, and the color pixel its on. An easier way to do this is to make a mini program with AutoIt that gets your mouse position. I'll give you the code right here:

;start of scrip

hotkeyset("a","change")
Func change()
&#036;pos=mousegetpos()
MsgBox(0,"Coords","Your mouse coords are (" & &#036;pos[0] & "," & &#036;pos[1] & ")")
EndFunc
While 1
WEnd

;end of scrip

OK. Since this is in the guides thread, I might as well explain what this program does. It makes a hotkey "a", so when you press the "a" key, it calls the function "change()". The function change() calls a function called mousegetpos(). mousegetpos() is a built in function of autoit that gets the current position of the mouse, and stores it into an array. An array is like a series of numbers stored under one variable name. getmousepos() stores the x coordinate in "&#036;variablename[0]" and the y coordinate in "variablename[1]". In this case it is "&#036;pos[0]" and "pos[1]". Now the function change() outputs a message box that tells the use the coordinates. Very simple script.

To recap things, to use this just past this code into autoit, start the script, and click "a" when your mouse is at the place where you want to find the coordinates.

Just curious, what are you making that opens ie? Or were you just playing around?
01/20/2007 05:25 bigassmuffin#34
Code:
&#036;nbr=InputBox&#40;&#34;Input Box&#34;,&#34;Give me a number 1-100&#34;&#41;&#59;InputBox&#40;&#41; is a built in GUI function that automatically creates a window where the user enters text or a number. Since there is a '&#036;nbr=' before it, whatever the user enters into the box will be stored into the variable '&#036;nbr'
If &#036;nbr>50 Then&#59; If &#036;nbr is greater than 50 THEN do the following until the if is closed
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was greater than 50&#34;&#41;&#59; like inputbox, but simply displays text to the user and exits when they click &#34;ok&#34;
EndIf&#59; end of the if-statement
If &#036;nbr&#60;50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was less than 50&#34;&#41;
EndIf
If &#036;nbr=50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was 50&#34;&#41;
EndIf
Can be simpler...

Code:
&#036;nbr=InputBox&#40;&#34;Input Box&#34;,&#34;Give me a number 1-100&#34;&#41;&#59;InputBox&#40;&#41; is a built in GUI function that automatically creates a window where the user enters text or a number. Since there is a '&#036;nbr=' before it, whatever the user enters into the box will be stored into the variable '&#036;nbr'
If &#036;nbr>50 Then&#59; If &#036;nbr is greater than 50 THEN do the following until the if is closed
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was greater than 50&#34;&#41;&#59; like inputbox, but simply displays text to the user and exits when they click &#34;ok&#34;
ElseIf &#036;nbr&#60;50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was less than 50&#34;&#41;
ElseIf &#036;nbr=50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was 50&#34;&#41;
EndIf
01/20/2007 08:34 spoonieluv97#35
Quote:
Originally posted by bigassmuffin@Jan 20 2007, 05:25
Code:
&#036;nbr=InputBox&#40;&#34;Input Box&#34;,&#34;Give me a number 1-100&#34;&#41;;InputBox&#40;&#41; is a built in GUI function that automatically creates a window where the user enters text or a number. Since there is a '&#036;nbr=' before it, whatever the user enters into the box will be stored into the variable '&#036;nbr'
If &#036;nbr>50 Then; If &#036;nbr is greater than 50 THEN do the following until the if is closed
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was greater than 50&#34;&#41;; like inputbox, but simply displays text to the user and exits when they click &#34;ok&#34;
EndIf; end of the if-statement
If &#036;nbr&#60;50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was less than 50&#34;&#41;
EndIf
If &#036;nbr=50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was 50&#34;&#41;
EndIf
Can be simpler...

Code:
&#036;nbr=InputBox&#40;&#34;Input Box&#34;,&#34;Give me a number 1-100&#34;&#41;;InputBox&#40;&#41; is a built in GUI function that automatically creates a window where the user enters text or a number. Since there is a '&#036;nbr=' before it, whatever the user enters into the box will be stored into the variable '&#036;nbr'
If &#036;nbr>50 Then; If &#036;nbr is greater than 50 THEN do the following until the if is closed
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was greater than 50&#34;&#41;; like inputbox, but simply displays text to the user and exits when they click &#34;ok&#34;
ElseIf &#036;nbr&#60;50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was less than 50&#34;&#41;
ElseIf &#036;nbr=50 Then
MsgBox&#40;0,&#34;Output Box&#34;,&#34;Your number was 50&#34;&#41;
EndIf
k.
01/21/2007 18:43 zeroRooter#36
ooooo kool


<hr>Append on Jan 21 2007, 18:52<hr>
Quote:
Originally posted by spoonieluv97+Jan 20 2007, 00:45--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (spoonieluv97 @ Jan 20 2007, 00:45)</td></tr><tr><td id='QUOTE'>
Quote:
Originally posted by -zeroRooter@Jan 19 2007, 23:05
<!--QuoteBegin--spoonieluv97
Quote:
@Jan 6 2007, 21:15
Any questions? It took me a while to write this :(

ya umm how do i determine my mouse posiotion. lets say i wanna click ie then how do i determine where the mouse postion is for ie on my desktop.
Theres a program called MacroExpress, and inside that program there is a little tool that is very handy. Where ever you mouse is, it tells you the coordinates of your mouse in that window, on the whole screen, and the color pixel its on. An easier way to do this is to make a mini program with AutoIt that gets your mouse position. I'll give you the code right here:

;start of scrip

hotkeyset("a","change")
Func change()
&#036;pos=mousegetpos()
MsgBox(0,"Coords","Your mouse coords are (" & &#036;pos[0] & "," & &#036;pos[1] & ")")
EndFunc
While 1
WEnd

;end of scrip

OK. Since this is in the guides thread, I might as well explain what this program does. It makes a hotkey "a", so when you press the "a" key, it calls the function "change()". The function change() calls a function called mousegetpos(). mousegetpos() is a built in function of autoit that gets the current position of the mouse, and stores it into an array. An array is like a series of numbers stored under one variable name. getmousepos() stores the x coordinate in "&#036;variablename[0]" and the y coordinate in "variablename[1]". In this case it is "&#036;pos[0]" and "pos[1]". Now the function change() outputs a message box that tells the use the coordinates. Very simple script.

To recap things, to use this just past this code into autoit, start the script, and click "a" when your mouse is at the place where you want to find the coordinates.

Just curious, what are you making that opens ie? Or were you just playing around? [/b][/quote]
you mentioned something about your arhcer bot that searches for a certain collor pixel can you tell me how you did that cuz i trying to make a bot for another game xD thx btw for showing me this program
01/21/2007 18:53 saulius321#37
its impossible to make program that it close error window in co
dc window i mean
01/21/2007 21:21 zeroRooter#38
Quote:
Originally posted by saulius321@Jan 21 2007, 18:53
its impossible to make program that it close error window in co
dc window i mean
uhh ya it actually is...
01/22/2007 00:14 spoonieluv97#39
Quote:
Originally posted by saulius321@Jan 21 2007, 18:53
its impossible to make program that it close error window in co
dc window i mean
It is possible to make that. I don't think it's possible to do it in AutoIt, but it is in Visual Basic. Once I find some time and my friend gets me VB 2005, I'm gonna start learning it. And for the person that wanted to know about searching for a pixel color, it goes something like this:

;start script

&#036;coord = Pixelsearch(0, 0, 500, 500, "0xB50400", 1, 20)
If @error <> 1 then
MouseClick("right", &#036;coord[0], &#036;coord[1] )
Endif

;endscipt

Explanation
Line 1: this runs the function "pixelsearch". The first four parameters are the left,top,right,and bottom border coordinates of the rectange to search. The about example would search a rectange starting at (0,0) wiht a width and height of 500. The 5th parameter is the color to search for. "0xB50400" is the color of a CO healthbar. The 6th parameter is how many shades different of that color it will search for. The 7th parameter is how many pixels its searches. Entering 20 with search every 20 pixels. If it finds a pixel with this color, it stores the x coord into &#036;coord[0] and the y coord into &#036;coord[1]. If it can't find one, @error is set to 1.
Line 2: If error does not equal 1 (meaning it found a pixel), Then....
Line 3: Clicks (&#036;coord[0],&#036;coord[1]) once
Line 4: End of if-statement
01/22/2007 11:10 liljkiller00#40
got a question is autoit for conquer like ACTool for maplestory?
01/22/2007 19:13 zeroRooter#41
Quote:
Originally posted by spoonieluv97+Jan 22 2007, 00:14--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (spoonieluv97 @ Jan 22 2007, 00:14)</td></tr><tr><td id='QUOTE'> <!--QuoteBegin--saulius321@Jan 21 2007, 18:53
its impossible to make program that it close error window in co
dc window i mean
It is possible to make that. I don't think it's possible to do it in AutoIt, but it is in Visual Basic. Once I find some time and my friend gets me VB 2005, I'm gonna start learning it. And for the person that wanted to know about searching for a pixel color, it goes something like this:

;start script

&#036;coord = Pixelsearch(0, 0, 500, 500, "0xB50400", 1, 20)
If @error <> 1 then
MouseClick("right", &#036;coord[0], &#036;coord[1] )
Endif

;endscipt

Explanation
Line 1: this runs the function "pixelsearch". The first four parameters are the left,top,right,and bottom border coordinates of the rectange to search. The about example would search a rectange starting at (0,0) wiht a width and height of 500. The 5th parameter is the color to search for. "0xB50400" is the color of a CO healthbar. The 6th parameter is how many shades different of that color it will search for. The 7th parameter is how many pixels its searches. Entering 20 with search every 20 pixels. If it finds a pixel with this color, it stores the x coord into &#036;coord[0] and the y coord into &#036;coord[1]. If it can't find one, @error is set to 1.
Line 2: If error does not equal 1 (meaning it found a pixel), Then....
Line 3: Clicks (&#036;coord[0],&#036;coord[1]) once
Line 4: End of if-statement [/b][/quote]
your so damn smart i wouldnt of igured that onje out lol im more into python...
01/22/2007 19:36 KraHen#42
i like it :D +k
01/23/2007 01:17 spoonieluv97#43
Quote:
Originally posted by liljkiller00@Jan 22 2007, 11:10
got a question is autoit for conquer like ACTool for maplestory?
I'm sorry, I can't answer your question because I've never played maple story, so I don't know what ACTool is.
01/23/2007 06:16 Coup_de-grāce#44
hey,

Is it possible to translate the exe file back into the script?
If possible, how?

Thx
01/23/2007 13:39 spoonieluv97#45
Quote:
Originally posted by Coup_de-grāce@Jan 23 2007, 06:16
hey,

Is it possible to translate the exe file back into the script?
If possible, how?

Thx
Yeah, what you do is go to Start>All Programs>AutoIt v3>Extras>Decompile from .exe to script. Then you choose location of .exe But when you compile a script to .exe, it still keeps the script which you can still edit and run.