Jump to content

super simple script


Recommended Posts

I am new with AutoIT

$var2 = 1
$var = PixelGetColor( 600 , 450 )
Do
MouseClick("left", 900, 400, 1)
$var2 = $var2 - 1
Until $var2 = 0

If $var = 11645361 Then
MouseClick("left", 630, 700, 1)
MouseClick("left", 675, 650, 30)
MouseClick("left", 900, 320, 10)
ElseIf $var <> 11645361 Then
MouseClick("left", 720, 700, 1)
MsgBox(0,"Working!", $var)
EndIf

How would I make it repeat from the bottom to the top.

I want this script to press one button on the screen, then check to see if 600,450 is the right color, and if so click one button, then another 30 times, then another 10 times. If not. I would like it to press A DIFFERENT button and then repeat at "If $var = 116.. etc.."

Also I would ilke it to repeat from the beginning after it finishes the 10 mouse clicks.

Thanks for helping a noob,

Zarox

Edited by Zarox
Link to comment
Share on other sites

I want this script to press one button on the screen, then check to see if 600,450 is the right color, and if so click one button, then another 30 times, then another 10 times. If not. I would like it to press A DIFFERENT button and then repeat at "If $var = 116.. etc.."

Also I would ilke it to repeat from the beginning after it finishes the 10 mouse clicks.

Try this (UNTESTED):

HotKeySet("{ESC}", "Terminate")
do
; I would like this script to ...
MouseClick("left", 900, 400, 1) ; ... press one button on the screen ...
$var = PixelGetColor( 600 , 450 ); ... then check to see if 600,450 is the right color ...
while True
If $var = 11645361 Then; ... and if so ...
MouseClick("left", 630, 700, 1); ... click one button ...
MouseClick("left", 675, 650, 30); ... then another 30 times ...
MouseClick("left", 900, 320, 10); ... then another 10 times ...
Else; ... If not ...
MouseClick("left", 720, 700, 1); ... I would like it to press A DIFFERENT button ...
MsgBox(0,"Working!", $var)
EndIf
$var = PixelGetColor( 600 , 450 )
wend; ... and then repeat at "If $var = 116 ...
until False; ... Also I would ilke it to repeat from the beginning after it finishes the 10 mouse clicks.
Func Terminate()
    Exit 0
EndFunc

Wasn't sure whether the repeat from beginning was correct, since I didn't fully understand "the 10 mouse clicks" - what 10 mouse clicks?

Link to comment
Share on other sites

HotKeySet("{ESC}", "Terminate")
do
; I would like this script to ...
MouseClick("left", 900, 400, 1); ... press one button on the screen ...
MouseClick("left", 725, 700, 1)
$var = PixelGetColor( 600 , 450 ); ... then check to see if 600,450 is the right color ...
while True
If $var = 11645361 Then; ... and if so ...
MouseClick("left", 630, 730, 1); ... click one button ...
MouseClick("left", 675, 650, 30); ... then another 30 times ...
MouseClick("left", 900, 320, 10); ... then another 10 times ...
Else; ... If not ...
MouseClick("left", 720, 730, 1); ... I would like it to press A DIFFERENT button ...
Sleep(1000)
EndIf
$var = PixelGetColor( 600 , 450 )
wend; ... and then repeat at "If $var = 116 ...
until False; ... Also I would ilke it to repeat from the beginning after it finishes the 10 mouse clicks.
Func Terminate()
    Exit 0
EndFunc

I have gotten it all to work, except making the program start from the beginning after running:

MouseClick("left", 630, 730, 1); ... click one button ...
MouseClick("left", 675, 650, 30); ... then another 30 times ...
MouseClick("left", 900, 320, 10); ... then another 10 times ...
Edited by Zarox
Link to comment
Share on other sites

I have gotten it all to work, except making the program start from the beginning after running:

MouseClick("left", 630, 730, 1); ... click one button ...
MouseClick("left", 675, 650, 30); ... then another 30 times ...
MouseClick("left", 900, 320, 10); ... then another 10 times ...
You seem to have two loops, one repeating from beginning if the above mouseclicks happen, the other repeating from If $var = 11645361 Then if not.

Try this (UNTESTED):

HotKeySet("{ESC}", "Terminate")
$PressButton1 = True; Makes initial clicks happen
While True
  if $PressButton1 then
    MouseClick("left", 900, 400, 1)
    MouseClick("left", 725, 700, 1)
    $PressButton1 = False; ensures that initial clicks only happen once pixel of right color is detected
  endif
  $var = PixelGetColor( 600 , 450 )
  If $var = 11645361 Then
    MouseClick("left", 630, 730, 1)
    MouseClick("left", 675, 650, 30)
    MouseClick("left", 900, 320, 10)
    $PressButton1 = True; pixel was detected - run from "beginning"
  Else
    MouseClick("left", 720, 730, 1)
    Sleep(1000)
  EndIf
wend

Func Terminate()
    Exit 0
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...