Sign in to follow this  
Followers 0
prdfy

WinExists or Winactive Help

6 posts in this topic

I am having a problem with the correct syntax to use the "Advanced Window Descriptions" for the WinExists and WinActive functions.

I need to automate a window by matching its width and height. The help file says the following, but I can't get it to work.

X \ Y \ W \ H - The position and size of a window

Here is what I have so far just in test. I just using a message box for now so I can verify if it will hit on the correct box. I have to use width and height because it is a Citrix client and that is the only info the Autoit Info tool can see.

-------------

While 1

Sleep(100)

WEnd

If WinActive("[[W:535;H:136]") then

MsgBox(1,"","it worked")

EndIf

-----------

So what is the correct syntax for specifying the width and height when using WinActive or WinExists?

Thanks

Share this post


Link to post
Share on other sites

prdfy,

A couple of problems with that code:

- 1. You will never get to the WinActive line because you never leave the While...WEnd loop. :)

- 2. You have an extraneous [ in the WinActive syntax.

Try this: :idea:

While 1
    If WinActive("[W:535;H:136]") Then
        MsgBox(1,"","it worked")
        ExitLoop
    EndIf
    Sleep(10)
WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You can also use WinGetPos to retrieves the position and size of a given window

While 1
    Sleep (100)
    $getsize = WinGetPos ('[Active]')
    If $getsize[2] = 535 And $getsize[3] = 136 Then
        MsgBox(1,"","it worked")
        ExitLoop
    EndIf
WEnd

Note : you must put your fuctions in a loop for it to work!

Edited by logmein

Share this post


Link to post
Share on other sites

logmein,

No, WinExists and WinActive is only use for windows title and text, not for width and height

WRONG. Please do not post inaccurate information. :idea:

Go and look in the Help file under <Using AutoIt - Window Titles and Text (Advanced)> and scroll down to where it says:

Advanced Window Descriptions

A special description can be used as the window title parameter. This description can be used to identify a window by the following properties:

[...]

X \ Y \ W \ H - The position and size of a window

If I posted the code it is because it works. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks Melba23,

That worked.

Cheers,

Prdfy

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  
Followers 0