Jump to content

WinMove() not moving and resizing with single command


willichan
 Share

Recommended Posts

I am having an interesting problem with WinMove() when moving multiple windows.

Running this code

WinMove("Session A - [24 x 80]", "", 170, 80, 735, 413, 1)
WinMove("Session B - [24 x 80]", "", 915, 80, 735, 413, 1)
WinMove("Session C - [24 x 80]", "", 170, 480, 735, 413, 1)
WinMove("Session D - [24 x 80]", "", 915, 480, 735, 413, 1)

both moves AND resizes the first window, but only moves the remaining windows without resizing them.

I tried interjecting a Sleep(100) between each WinMove() call, but no change in behavior.

However, if I double up the calls,

Global $a
$a = WinMove("Session A - [24 x 80]", "", 170, 80, 735, 413, 1)
If $a <> 0 Then WinMove("Session A - [24 x 80]", "", 170, 80, 735, 413, 1)
WinMove("Session B - [24 x 80]", "", 915, 80, 735, 413, 1)
If $a <> 0 Then WinMove("Session B - [24 x 80]", "", 915, 80, 735, 413, 1)
WinMove("Session C - [24 x 80]", "", 170, 480, 735, 413, 1)
If $a <> 0 Then WinMove("Session C - [24 x 80]", "", 170, 480, 735, 413, 1)
WinMove("Session D - [24 x 80]", "", 915, 480, 735, 413, 1)
If $a <> 0 Then WinMove("Session D - [24 x 80]", "", 915, 480, 735, 413, 1)

then everything seems to work, but it seems a rather uneligant solution.

Any thoughts?

(Using AutoIt 3.3.12.0 on a Win7-64bit machine)

 

Link to comment
Share on other sites

That worked. 

:huh2:  I am still puzzled as to why it would move the window without activating it first, but not resize it.

Link to comment
Share on other sites

Actually, I just found that activating first still intermittantly does not resize.

Global $a
$a = WinActivate("Session A - [24 x 80]", "")
If $a <> 0 Then WinMove("Session A - [24 x 80]", "", 170, 80, 735, 413, 1)
$a = WinActivate("Session B - [24 x 80]", "")
If $a <> 0 Then WinMove("Session B - [24 x 80]", "", 915, 80, 735, 413, 1)
$a = WinActivate("Session C - [24 x 80]", "")
If $a <> 0 Then WinMove("Session C - [24 x 80]", "", 170, 480, 735, 413, 1)
$a = WinActivate("Session D - [24 x 80]", "")
If $a <> 0 Then WinMove("Session D - [24 x 80]", "", 915, 480, 735, 413, 1)

This code works half the time, but only resized the first window the other half. :ermm:

So far the only solution that has not failed is to WinMove() twice for each window. :huh2:  :think:

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

×
×
  • Create New...