Guest MacExcelsior Posted March 9, 2005 Share Posted March 9, 2005 I have a script that works, but I want to change it slightly. and i am stuck. The script i have will click on a button via classname, but I want it to click based on a button location by using the window x & Y location. I am sure it can be done, here is part of my script. :Pre-initialization :Set Name of Window Global $windowname = "MyWindowName" Global $inspector = "Connected to """ & $windowname; Initialize Buttons; Location of button $Button1 = "554, 318, 2"; $Button2 = "239, 320, 2"; Set Coordinate mode to relative to window client area AutoItSetOption ( "PixelCoordMode", 2 ); Wait for the window of table to become active WinWaitActive($windowname); Main Loop While WinExists($windowname) Sleep(300); $button1Visible = ControlCommand($windowname, "", $Button1, "IsVisible", ""); $button2Visible = ControlCommand($windowname, "", $Button2, "IsVisible", ""); if $button1Visible = 1 then Sleep(Random(1500, 2500)) $action = GetAction(); if $action = 1 then if StringInStr(ControlGetText($windowname, "", $Button2), "button2") = 1 then ControlClick($windowname, "", MouseClick($Button1)); This is were I get stuck. THank you John Link to comment Share on other sites More sharing options...
WHRobin566 Posted March 13, 2005 Share Posted March 13, 2005 (edited) Not to great at window clicking but try ControlMouseClick that might do it i think if it dont then theres another way. heres how you do it. this will probly not work you will need to add corrections and stuff cause i dont want to spend a long time making a script but if you need more help i can make you one $Fold = 0 $Check = 0 $Call = 0 $Raise = 0 Opt("WindowTitleMatchMode",2") $pokert = Wingettitle("poker tables name thats always the same well part of it") $inspec = wingettitle("Connected to ") Winmove($pokert, 0, 0) Winmove($inspec, 0, 0) Set the pos you always want it to have while 1 if pixelgetcolor(0, 0) = 0 Then $Fold = 1 endif if pixelgetcolor(0, 0) = 0 Then $Check = 1 endif if pixelgetcolor(0, 0) = 0 Then $Call = 1 endif if pixelgetcolor(0, 0) = 0 Then $Raise = 1 endif do pixelsearches at locations where it will show only that letter so if the check is in calls place or somin if pixelgetcolor(0, 0) = 0 Then if $Fold = 1 then MouseClick("left", 0, 0) endif endif if pixelgetcolor(0, 0) = 0 Then if $Check = 1 Then MouseClick("left", 0, 0) endif endif if pixelgetcolor(0, 0) = 0 Then if $Call = 1 Then MouseClick("left", 0, 0) endif endif if pixelgetcolor(0, 0) = 0 Then if $Raise = 1 Then MouseClick("left", 0, 0) endif endif sleep(10) wend and well you have to do a lot of pos finding for that but i will break it down what it does it searches for buttons then it searches for light then if the button is there it clicks it if its not there then well it dosent do anything. Hope this helps! Edited March 13, 2005 by WHRobin566 Witch Hunter Robin Link to comment Share on other sites More sharing options...
Ozi Posted July 2, 2007 Share Posted July 2, 2007 I have a script that works, but I want to change it slightly. and i am stuck.The script i have will click on a button via classname, but I want it to click based on a button location by using the window x & Y location.I am sure it can be done, here is part of my script.:Pre-initialization :Set Name of WindowGlobal $windowname = "MyWindowName"Global $inspector = "Connected to """ & $windowname; Initialize Buttons; Location of button$Button1 = "554, 318, 2";$Button2 = "239, 320, 2"; Set Coordinate mode to relative to window client areaAutoItSetOption ( "PixelCoordMode", 2 ); Wait for the window of table to become activeWinWaitActive($windowname); Main Loop While WinExists($windowname) Sleep(300); $button1Visible = ControlCommand($windowname, "", $Button1, "IsVisible", "");$button2Visible = ControlCommand($windowname, "", $Button2, "IsVisible", ""); if $button1Visible = 1 then Sleep(Random(1500, 2500)) $action = GetAction(); if $action = 1 then if StringInStr(ControlGetText($windowname, "", $Button2), "button2") = 1 then ControlClick($windowname, "", MouseClick($Button1));This is were I get stuck. THank youJohnOpt ( "MouseCoordMode", 0 ) 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