Jump to content

How to move a window incremental


kart442
 Share

Recommended Posts

I can get it to move one time only, need it to move for each step.

Thanks for your help.

CODE
Sleep(5000)

WinMove("inputter.bmp - Paint", " ", 363, 108)

Local $red = 0xFF0000

Local $green = 0x00FF00

Sleep(1000)

For $y = 686 To 245 Step - 63

For $x = 677 To 1118 Step 63

If PixelGetColor($x, $y) = $red Then

If Not @error Then

MsgBox(0, "RED", $x & "," & $y)

WinMove("inputter.bmp - Paint", " ", 363, 108) ; How do I get this window to move "x" - 63 from current position and for "y" to stay the same for each step of "$y"

EndIf

EndIf

If PixelGetColor($x, $y) = $green Then

If Not @error Then

MsgBox(0, "GREEN", $x & "," & $y)

EndIf

EndIf

Next

Next

Link to comment
Share on other sites

That's because the window has been in the positon(363,108). In fact, it has moved but you can see the movement.

refer to this method:

Opt("WinTitleMatchMode",2)

Dim $title="Untitled"

if WinExists($title) Then

WinActivate($title)

EndIf

$size=WinGetPos($title)

MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])

WinMove($title, "", 0,0,300, 300)

Do

$x=WinGetPos($title)

;MsgBox(0,'x:',$x[0])

WinMove($title,"",$x[0]+20,$x[1],$x[2]+20,$x[3])

Sleep(1000)

Until $x[0]>=100

Do

$y=WinGetPos($title)

WinMove($title,"",$y[0],$y[1]+20,$y[2],$y[3]+20)

Sleep(1000)

Until $y[1]>=100

$size=WinGetPos($title)

MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])

Important Notes: before run this script, please new a txt file, and don't name it!

Edited by mik
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...