Jump to content

WinMove syntax?


Recommended Posts

Hi all,

I'm very new to scripting in general and AutoIt3 in particular. I've got a syntax problem that is foxing me, and I just can't see it. I've searched the Help file, and this forum, to no avail.

Basically, I'm saving a window size, resizing the window, then later resetting it. The following code shows the things I've tried:

#include <Array.au3>
Dim $WSArray [2]
;
; Open application here with RUN function
WinWaitActive ("Window Title")
;
;save window size for later
$WSArray = WinGetClientSize ("")
;
;display window size
_ArrayDisplay( $WSArray, "Window Size" )
;
; set new window size
WinMove ("","",0,0,1024,738)
sleep(1000)
;
; now reset window size
; first attempt fails: Error in Expression
WinMove ("Window Title","",0,0,$WSArray(0),$WSArray(1))
;
; second try - convert to number? Same error occurs
WinMove ("Window Title","",0,0, number($WSArray(0)), number($WSArray(1)))
;
; Help?

The $WSArray contains numbers, as shown by the _ArrayDisplay function, so I'm not sure why WinMove is barfing on either version of the code... all help gratefully received.

Thanks,

AlaN S>

Link to comment
Share on other sites

use [ ] instead of () for arrays

#include <Array.au3>
Dim $WSArray [2]
$title = "Untitled - Notepad"
;
; Open application here with RUN function
WinWaitActive ($title)
;
;save window size for later
$WSArray = WinGetClientSize ($title)
;
;display window size
_ArrayDisplay( $WSArray, "Window Size" )
;
; set new window size
WinMove ($title,"",0,0,1024,738)
sleep(1000)
;
; now reset window size
; first attempt fails: Error in Expression
WinMove ($title,"",0,0,$WSArray[0],$WSArray[1])
;
; second try - convert to number? Same error occurs
WinMove ($title,"",0,0, number($WSArray[0]), number($WSArray[1]))

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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