moth Posted November 24, 2011 Share Posted November 24, 2011 (edited) Hello guys! Been sitting with this for a while, havnt coded to much in autoit, dont really understand what i have done wrong, but i guess it keeps going into the first part all the time, i dont have a clue how to control the flow, can you guys pleae help out? expandcollapse popupDim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap Dim $Bufftimer $ExitKey = "{ESC}" $Color = 0x70635B $Left = 1 $Top = 1 $Right = 1024 $Bottom = 800 $ClickMouse = $MousePrimary $Bufftimer = 50 $CordX1 = 520 $CordY1 = 416 $CordX2 = 612 $CordY2 = 439 HotKeySet("{F12}", '_Exit') While 1 [color=#daa520]If Not @error Then Sleep(15000) Send("{F6}") Send("{F6}") Send("{F6}") Send("{F6}") Sleep(3000) Send("{F7}") Send("{F7}") Send("{F7}") Send("{F7}") Sleep(3000) Send("{F8}") Send("{F8}") Send("{F8}") Send("{F8}") Sleep(3000) Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Send("{SPACE}") Sleep(2000) MouseClick("left",$CordX1,$CordY1,1,2) Sleep(2000) MouseClick("left",$CordX2,$CordY2,1,2) Sleep(1000) $Bufftimer = $Bufftimer - 50 EndIf[/color] While $Bufftimer < 50 If Not @error Then $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color) MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 2, 5) MouseClick("right", $SearchResult[0], $SearchResult[1], 2, 1) Send ("{F4}{f2}") sleep(19000) Send('{Right down}') Sleep(300) Send('{Right up}') sleep(800) $Bufftimer = $Bufftimer + 1 EndIf WEnd WEnd Func _Exit() Exit EndFunc, When script is started, i want it to go trough the yellow code, then for 30 mins just keep looping the bottom code, then again go up top and run through once there, and dont mind the double keypresses, just me experimenting. Error message says, Subscript used with non-Array- variable. Line 50, which is this " $Bufftimer = $Bufftimer - 50" Thanks in advance Edited November 24, 2011 by moth Link to comment Share on other sites More sharing options...
UEZ Posted November 24, 2011 Share Posted November 24, 2011 I don't know what you trying to do but probably the error is with PixelSearch line: $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color) If PixelSearch finds the color it will return a 2D array with the coordinates otherwise no array. MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 2, 5) MouseClick uses the array $SearchResult to click that coordinate but it will fail when PixelSearch fails! You can use something like this to avoid the error message $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color) If Not @error Then Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ 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