ArchDracis Posted June 14, 2007 Posted June 14, 2007 First off Im a total noob. So please use KY. expandcollapse popup$1 = 1 While $1 = 1 Sleep(3000) If WinActive("PROGRAM1", "") Then Call ("Add") Else Exit EndIf $1 = $1 + 1 WEnd Func Add() $StartX = 175 $StartY = 200 $AddX = 205 $AddY = 280 $i = 0 $X = 0 $Y = 0 $Slots = 5;Rows you have open. WinActivate("PROGRAM1", "") Sleep(1000) MouseClick("left", 500, 500, 2) While $i <= 30 MouseClick("right", $StartX, $StartY + $Y, 2) Sleep(1000) MouseClick("left", $AddX, $AddY + $Y, 2) Sleep(21000) $StartX = $StartX + 32 $AddX = $AddX + 32 $X = $X + 1 If $X = 6 Then $Y = $Y + 32 $X = 0 $StartX = 175 $AddX = 205 EndIf If $Y = $Slots/32 Then ExitLoop $i = $i + 1 If $i = 40 Then Exitloop If WinActive("PROGRAM1", "") Then Else Exit EndIf WEnd EndFunc
PaulIA Posted June 14, 2007 Posted June 14, 2007 First off Im a total noob. So please use KY. expandcollapse popup$1 = 1 While $1 = 1 Sleep(3000) If WinActive("PROGRAM1", "") Then Call ("Add") Else Exit EndIf $1 = $1 + 1 WEnd Func Add() $StartX = 175 $StartY = 200 $AddX = 205 $AddY = 280 $i = 0 $X = 0 $Y = 0 $Slots = 5;Rows you have open. WinActivate("PROGRAM1", "") Sleep(1000) MouseClick("left", 500, 500, 2) While $i <= 30 MouseClick("right", $StartX, $StartY + $Y, 2) Sleep(1000) MouseClick("left", $AddX, $AddY + $Y, 2) Sleep(21000) $StartX = $StartX + 32 $AddX = $AddX + 32 $X = $X + 1 If $X = 6 Then $Y = $Y + 32 $X = 0 $StartX = 175 $AddX = 205 EndIf If $Y = $Slots/32 Then ExitLoop $i = $i + 1 If $i = 40 Then Exitloop If WinActive("PROGRAM1", "") Then Else Exit EndIf WEnd EndFunc; These 3 lines replace your loop as it will only ; execute once anyway, so you don't need a loop. Sleep(3000) WinActivate("Program1") if WinActive("Program1") then Add() Func Add() ; All variables used in functions should be delcared locally Local $I, $X, $Y, $AddX=205, $AddY=280, $Slots=5, $StartX=175, $StartY=200 MouseClick("left", 500, 500, 2) ; If you're incrementing $I by 1, just us a loop for $I = 0 to 29 ; Normally, you don't use Exit in a function if not WinActive("Program1") then Return MouseClick("right", $StartX, $StartY + $Y, 2) Sleep(1000) MouseClick("left" , $AddX , $AddY + $Y, 2) ; This can't be right... 21 seconds? Sleep(21000) $StartX += 32 $AddX += 32 $X += 1 If $X = 6 Then $Y += 32 $X = 0 $StartX = 175 $AddX = 205 EndIf ; The following line is useless. Y will never equal 0.16. Maybe you meant $Slots * 32? If $Y = $Slots/32 Then ExitLoop ; The following line is useless. You'll exit the loop before $I gets to 40 If $I = 40 Then Exitloop next EndFunc Auto3Lib: A library of over 1200 functions for AutoIt
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