Jump to content

[python] controlclick not working when window is minimized


nmontec
 Share

Recommended Posts

Dear All,

I am having some trouble in automating a window. Everything is fine is I may use the couple WinActivate/WinWaitActive but it is not working if the window is minimized.

I need to click a button and I tried the following:

I declared in an object a reference like this:

self.autoit=win32com.client.Dispatch('AutoItX3.Control')
self.autoit.AutoItSetOption('WinTitleMatchMode',2)
self.autoit.AutoItSetOption("WinDetectHiddenText", 1)

And a t a certain point I press the Exit button

self.autoit.ControlClick('Dome','','[CLASSNN:WindowsForms10.BUTTON.app.0.378734a15]')
self.autoit.ControlClick('Dome','','[NAME:ButtonExit]')
self.autoit.ControlClick('Dome','','[CLASS:WindowsForms10.BUTTON.app.0.378734a; INSTANCE:15]')

Now, If the window is active and screen is not locked all is ok.But if window is minimized and/or screen is locked the command does not have any effect on the window. As far as I know controlclick should work also on these situations. Am I wrong?

Thanks a lot for your help

Nicola

Link to comment
Share on other sites

Hello Nicola,

Seeing as there has been no reply since Friday, I thought I'd chime in (hope you don't mind!):

Now, I'm by no means an expert in AutoIt, nor in Python (just an enthusiast in both), but going from my own experiences (and the ControlClick function page in the help file):

Quote

Some controls will resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using ControlClick().

A minimized window is usually not an active window, so that's likely why it's not working. ...Restoring, then activating the window won't work?

==========

Have you had much other trouble using an 'AutoIt class' in Python? That's a great idea, and one I haven't thought of! :thumbsup:

bloopie

Edited by bloopie
fixed typo
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

×
×
  • Create New...