Jump to content

$x or $y based on other variable


jawed
 Share

Recommended Posts

im wishing you guys a good (here in germany rainy ^^) morning :)

i would like to ask you guys, is there a possible solution for this problem without putting it in into switch.. case or 4 if...else?

i want a function to move my mouse and check every pixel for the Color white. i can say "top", "left", "right" or "bottom" as direction

func _Comboboxsearch($name, $item, $direction)
   $pos = ControlGetPos($Caption, "", "[TEXT:"&$name&"]")
   $y = $pos[1] + 10
         $color = PixelGetColor($x, $y)
         if Hex($color, 6) = "FFFFFF" Then
            for $x = $x + 10 to 1160 Step 1            ;<<<<<<<problem
               $color = PixelGetColor($x, $y)
               if Hex($color, 6) = "FFFFFF" Then
                  for $x = $x + 10 to 1160 Step 1  ;<<<<<<<problem
                 $color = PixelGetColor($x, $y)
                     if Hex($color, 6) = "C0C0C0" Then
                        MouseClick("left", $x + 7, $y, 2, 0)
                        sleep(222)
                        send($Item)
                        sleep(222)
                        send("{ENTER}")
                        sleep(222)
                        ControlFocus($Caption, "", "[REGEXPCLASS:AfxFrame]")
                        Return 1
                     EndIf
                  Next
               EndIf
            Next
         EndIf

the problem is, based on the direction i have to let it move like (the problem lines)

$x = $x +-1 OR $y = $y +-1

the +- problem is solved, the x or y problem not...

btw i think do... while is better then for...next

Edited by jawed
Link to comment
Share on other sites

this script is targeting a combobox in an other programm. im targeting it through the label its reffered to. so i need the "direction", i can tell him the combobox is in the "right" direction of the label or top/left/bottom. then going twice for the pixelsearch until i find it or the window ends...

the problem is.. not everything is targetable with controlcommand or controlclick.

Edited by jawed
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...