adrian1386 Posted January 2, 2006 Share Posted January 2, 2006 Ok this is the script I wrote... Yes I know it doesnt work this way but by looking at it it shows what Iam trying to achieve.WinActivate("program", "")Sleep(3000)Call("main")func main ()$coord = PixelSearch( 231, 397, 1101, 847, 0x0E0E17,0 )If $coord = @error ThenSend("{ESC}")ElseMouseClick("left", $coord)EndIfEndFuncAs you can see what I want to happen is once $coord knows the cordinates of the Hex color I want to apply a MouseClick directly to the variable, because the variable will change coordinates on the screen and wont be always in the same spot. How would I go about doing that? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 2, 2006 Moderators Share Posted January 2, 2006 Main(); Use it like this instead of Call("Main") Func Main() Local $coord = PixelSearch(231, 397, 1101, 847, 0x0E0E17) If Not @error And IsArray$coord) Then MouseClick("left", $coord[0], $coord[1], 1, 1) Else Send("{ESC}") EndIf EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
adrian1386 Posted January 2, 2006 Author Share Posted January 2, 2006 I got an error parsing call... It said the error was on the Array line. (I got rid of the mistake bracket, so thats not it)Ok this is the script I wrote... Yes I know it doesnt work this way but by looking at it it shows what Iam trying to achieve.As you can see what I want to happen is once $coord knows the cordinates of the Hex color I want to apply a MouseClick directly to the variable, because the variable will change coordinates on the screen and wont be always in the same spot. How would I go about doing that? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 2, 2006 Moderators Share Posted January 2, 2006 Yes I see it, my mistake was the '(' after IsArray was missing. Here's some tips for you... how did you get your Coords with AutoInfo.. Client / Screen / or Window? The reason I ask is to make sure that you have the right Opt('PixelCoordMode') and right Opt('MouseCoordMode') Check the Help under 'Opt' to make sure. Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Main(); Use it like this instead of Call("Main") Func Main() Local $coord = PixelSearch(231, 397, 1101, 847, 0x0E0E17) If Not @error And IsArray($coord) Then MouseClick("left", $coord[0], $coord[1], 1, 1) Else Send("{ESC}") EndIf EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
adrian1386 Posted January 2, 2006 Author Share Posted January 2, 2006 Ok it seems to work now. Thanks. I know I'm probably getting annoying now lol but mind explaining what IsArray does? and what is happening ? Like I said i'm really new to this so I'm trying to understand the stuff I'm putting in my scripts. 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