Jump to content

Complex Questions about Window Management/Control


Recommended Posts

Complex Questions about Window Management/Control Commands:

I have reviewed all the help file, and am confused by some things. Can someone help me please?

1) WinGetState defines 6 states..Exists,Visible,Enabled,Active,Min,Max.

'Normal Windows' Exist, are Visible, Active or Inactive and Maximized or Minimized.

I assume that the window must "Exist" for any of the other States to be true.

I do not understand what "Enabled" means. No AutoIT commands address it.

I assume I cannot AutoIt Windows that are InActive but must Activate First.

Hidden is a new term to me..does it simply mean leave the other states alone but don't write it to the display?

Can I simply Hide 'Normal Windows' and continue to AutoIt them?

2a) If a window is hidden,and I click on a control which spawns another window will it also be hidden?

In my experiments the new window starts visible and I have to hide it.

I am trying to automate some processes that I would like to run in the background (hidden) while I do "normal" Windows work. It is very disconcerting to have these "windows flash" until I "hide them"!

2b) How does "WinSearchChildren" fit into this.. If I want to wait on a Window spawned by a click in the first window do I need to set this? My example is the "Advanced" button on the "Display Properties" Window or the "New Window" in Internet Explorer

3) The help file is not very clear on what Windows Commands work with the various states.

There are some references to "hidden and minimized". Here are the help file "comments" and {my notes} by command:

{Assume ALL} means I assume they work with any "existing and Active" Window either visible or hidden, max or min.

If my Assumptions below are correct, it would appear that all Windows Management Commands will work with any "existing and Active" Window either visible or hidden, max or min. Is this true? Do any work with Inactive Windows(see MenuSelect)?

"StatusbarGetText can work on windows that are minimized or even hidden" :{Assume ALL}

"WinActivate works on minimized windows." {What about Hidden?}

WinActive :No references :{Assume ALL}

"WinExist will return 1 even if a window is hidden" :{Assume ALL}

"WinGetCaretPos - Returns the coordinates of the caret in the foreground window" { ??

?? What does this mean? Visible and Maximized? }

"WinGetClassList works on both minimized and hidden windows". :{Assume ALL}

"WinGetClientSize works correctly on (non-minimized) hidden windows":{Assume ALL but min}

WinGetHandle :No references :{Assume ALL}

"WinGetPos works fine with (non-minimized) hidden windows".{Assume ALL but min}

WinGetState :No references :{Assume ALL}

"WinGetText works on minimized windows, but only works on hidden windows if ..." :{Assume ALL with Opt}

"WinGetTitle works on both minimized and hidden windows" {Assume ALL}

"WinKill can work on both minimized and hidden windows" :{Assume ALL}

:WinMenuSelect says "the window can be INACTIVE, minimized, and/or even hidden."

:{Assume ALL} {but I thought a window had to be active for AutoIt???}

WinMinimizeAll/WinMinimizeAllUndo: :{Assume ALL} {Assume Hidden Windows stay hidden?}

"WinMove has no effect on minimized windows, but works on hidden windows" :{Assume ALL but min}

WinSetOnTop - :{This looks like another "state" to me but its not in WinGetState.} :{Assume ALL}

WinSetState - :{Assume ALL} {Implicitly applies to Hidden and Minimized}

WinSetTitle - :{Assume ALL}

WinWait - :{Assume ALL}

WinWaitActive - :{Assume ALL}

WinWaitClose -:{Assume ALL}

WinWaitNotActive - :{Assume ALL}

4) Controls however seem designed to work with Inactive Windows, although the only references to this are in Control Click and Control Send.

Control Click says: "Simulating a click on a control is only 100% accurate when the control's parent window is active - this is done automatically". What does this mean? I thought every window had to be active to be AutoIt'd. Does this mean I can Click on a control in an Inactive Window?

ControlSend says: "can send most of them--even to non-active or hidden windows!"

Is this true for all controls?.

5) ControlGetFocus returns the Control Ref# for the Control, but it is only used in GUI Commands. How do I get the Name/Text of the control that has Focus in a Window so I can save its position and restore it?

6) WinGetClassList returns a list of Controls WITHOUT the InstanceNumber. Is this a bug?

Without the instance number the data is not of much use, With it the Names are usable in Control Commands.

7) Is there a tutorial somewhere that expands on How to Control Windows in AutoIt?

Link to comment
Share on other sites

Complex Questions about Window Management/Control Commands:

I have reviewed all the help file, and am confused by some things. Can someone help me please?

1) WinGetState defines 6 states..Exists,Visible,Enabled,Active,Min,Max.

'Normal Windows' Exist, are Visible, Active or Inactive and Maximized or Minimized.

I assume that the window must "Exist" for any of the other States to be true.

I do not understand what "Enabled" means. No AutoIT commands address it.

I assume I cannot AutoIt Windows that are InActive but must Activate First.

Hidden is a new term to me..does it simply mean leave the other states alone but don't write it to the display?

Can I simply Hide 'Normal Windows' and continue to AutoIt them?

A "disabled" window resembles grayed-out controls that you cannot click on. It's not that useful, so nearly all windows you encounter are "enabled."

I think the ControlCommand functions automagically activate windows if necessary.

Hidden windows are invisible on screen, but they do exist and can be manipulated with ControlCommand's...

2a) If a window is hidden,and I click on a control which spawns another window will it also be hidden?

In my experiments the new window starts visible and I have to hide it.

I am trying to automate some processes that I would like to run in the background (hidden) while I do "normal" Windows work. It is very disconcerting to have these "windows flash" until I "hide them"!

Don't know what to tell you. You can put Opt("WinWaitDelay", 10) at the top of your script to help hide the window faster.

2b) How does "WinSearchChildren" fit into this.. If I want to wait on a Window spawned by a click in the first window do I need to set this? My example is the "Advanced" button on the "Display Properties" Window or the "New Window" in Internet Explorer

I'll let someone else answer this; I've never used this feature.

3) The help file is not very clear on what Windows Commands work with the various states.

There are some references to "hidden and minimized". Here are the help file "comments" and {my notes} by command:

{Assume ALL} means I assume they work with any "existing and Active" Window either visible or hidden, max or min.

If my Assumptions below are correct, it would appear that all Windows Management Commands will work with any "existing and Active" Window either visible or hidden, max or min. Is this true? Do any work with Inactive Windows(see MenuSelect)?

....

...

Assume "ALL" unless other stated :ph34r: I'm responsible for the content in quite a few of the documentation "remarks," but the docs might contain bugs or omissions.

4) Controls however seem designed to work with Inactive Windows, although the only references to this are in Control Click and Control Send.

Control Click says: "Simulating a click on a control is only 100% accurate when the control's parent window is active - this is done automatically". What does this mean? I thought every window had to be active to be AutoIt'd. Does this mean I can Click on a control in an Inactive Window?

ControlSend says: "can send most of them--even to non-active or hidden windows!"

Is this true for all controls?.

I'm pretty sure that ControlCommand and related functions automatically activate controls.

5) ControlGetFocus returns the Control Ref# for the Control, but it is only used in GUI Commands. How do I get the Name/Text of the control that has Focus in a Window so I can save its position and restore it?

Did you phrase that right?

ControlGetFocus returns a ClassName# which is different from from GUI stuff. GUI stuff in only in the unstable beta of AutoIt and uses Gui Ref#s. Could you clarify if you are talking about AutoIt-GUI stuff or normal window stuff?

6) WinGetClassList returns a list of Controls WITHOUT the InstanceNumber. Is this a bug?

Without the instance number the data is not of much use, With it the Names are usable in Control Commands.

You can calculate the instance number yourself. See SpyThing for an example:

http://www.autoitscript.com/forum/index.php?showtopic=3523 Note the code requires the latest unstable version of AutoIt.

Also keep in mind that checkbox controls are technially "button" controls.

7) Is there a tutorial somewhere that expands on How to Control Windows in AutoIt?

I know tutorials have been requested many times..... Anyone written one yet? Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

A "disabled" window resembles grayed-out controls that you cannot click on. It's not that useful, so nearly all windows you encounter are "enabled."

Yet AutoIt uses two (I think). SpashTextOn() and ProgressOn() used to create disabled windows. I don't know if they still do or not, though, since they are movable.

I'll let someone else answer this; I've never used this feature.

To explain this would require you to have working knowledge of the Z-Order. Obviously you don't have that knowledge, or you would already know the answer. Don't you love circles?

Anyway. If you ever run across a window that you are 100% positive you've got the title/text right for, yet you still can't get any Win* or Control* commands to work, then try using WinSearchChildren.

Developer note: Jon, Larry, whoever is "in charge" of Au3_Spy, it should be easy to add support for informing people if a Window is a child. Something like this should work (This is untested):

hWnd;   // This is the hWnd for the window under the moue
HWND hParent = GetAncestor(hWnd, GA_PARENT);
if (hParent != NULL && hParent != GetDesktopWindow())
{
    // It's a child window, so alert the user in the display somehow.
}

Edit: Fixed typo.

Edited by Valik
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...