Jump to content
Sign in to follow this  
dickep

Help file error

Recommended Posts

dickep

Ok. I have a problem.

I went to the Autoit help file and searched on "ControGetPos". In it there is an example and a button to "Open this script". I click on that button and the file opens in SciTE. Ok so far.

Now I try to run it and the following shows up in the output pane:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Examples\Helpfile\ControlGetPos.au3"

C:\Program Files\AutoIt3\Examples\Helpfile\ControlGetPos.au3 (3) : ==> Subscript used with non-Array variable.:

MsgBox(0, "Window Stats:", "POS: " & $pos[0] & "," & $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3] )

MsgBox(0, "Window Stats:", "POS: " & $pos^ ERROR

>Exit code: 1 Time: 0.563

What am I missing?

Autoit version 3.3.0.0

Thanks

Share this post


Link to post
Share on other sites
smashly

The problem is the example..

ControlGetPos() is being fired before the notepad Edit control has loaded..

It needs a WinWaitActive() or sleep() added after the Run("notepad.exe")..

Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$pos = ControlGetPos("[CLASS:Notepad]", "", "Edit1")
MsgBox(0, "Window Stats:", "POS: " & $pos[0] & "," & $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3])
Cheers

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.