Jump to content

Recommended Posts

Posted

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>

Posted

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.

 

Posted

Like you, I'm new to all this - Use the SciTe editor! Worth it's weight in gold!

The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

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
×
×
  • Create New...