Jump to content

WinExists or Winactive Help


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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