# \$x or \$y based on other variable

## 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

##### Share on other sites

Hi,

What is this script for?

There are surely more reliable ways to automate the target application.

Br, FireFox.

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

##### 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

##### Share on other sites

nobody who can help me out there...?

##### Share on other sites

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...