the_OG Posted January 13, 2007 Posted January 13, 2007 Hello, my pixelsearch script that I made in hopes of learning more about AutoIt has been giving me errors left and right. How would I fix this? Could you explain indepth? ; ************************************* ; pixelsearch test ; ************************************* #include <GuiConstants.au3> Opt("GUICoordMode",2) AutoItSetOption("TrayIconHide", 1) GUICreate("", 225, 100,200,200,$WS_DLGFRAME,$WS_THICKFRAME) GUICTRLcreateLabel("Press escape to close", 55, 30, 220,150,-1,-1) ; ***** define what colour we're wanting $pos = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x0E7112) ; a shade of blue ; ***** set hotkeys Global $scrp HotKeySet("{End}", "Toggle") ; hotkey to turn on/off Func Toggle() $scrp = NOT $scrp While $scrp sleep(50) MouseClick("left", $pos[0], $pos[1],1,0) Send("{End}") WEnd EndFunc ; ****** GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd ~The_OG
madmax Posted March 24, 2007 Posted March 24, 2007 Hello, my pixelsearch script that I made in hopes of learning more about AutoIt has been giving me errors left and right. How would I fix this? Could you explain indepth? ; ************************************* ; pixelsearch test ; ************************************* #include <GuiConstants.au3> Opt("GUICoordMode",2) AutoItSetOption("TrayIconHide", 1) GUICreate("", 225, 100,200,200,$WS_DLGFRAME,$WS_THICKFRAME) GUICTRLcreateLabel("Press escape to close", 55, 30, 220,150,-1,-1) ; ***** define what colour we're wanting $pos = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x0E7112) ; a shade of blue ; ***** set hotkeys Global $scrp HotKeySet("{End}", "Toggle") ; hotkey to turn on/off Func Toggle() $scrp = NOT $scrp While $scrp sleep(50) MouseClick("left", $pos[0], $pos[1],1,0) Send("{End}") WEnd EndFunc ; ****** GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd ~The_OG What is the error you get?
therks Posted March 24, 2007 Posted March 24, 2007 Most likely he's getting an invalid array error on this line:MouseClick("left", $pos[0], $pos[1],1,0)(At least that's what I got).Try adding some shade variation to your pixel search (6th param). If I had to guess, it's not finding the colour you're searching for anywhere (since you're doing an exact match), and thus it does not return an array. Try checking @error after your pixelsearch, or checking the $pos variable with IsArray(). My AutoIt Stuff | My Github
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