Sign in to follow this  
Followers 0
storme

Win XP/Windows 7 and WinExists

7 posts in this topic

G'day All

I'm writing a script that installes uTorrent Portable as part of it's operation.

There are a few screens I have to "click" through and I wrote this bit of code to handle one of these

Opt("WinTitleMatchMode", 4)

        If WinExists("µTorrent", "Do you really want to exit") Then
            WinActivate("µTorrent", "Do you really want to exit")
            WinWait("µTorrent", "Do you really want to exit")
            ControlClick("µTorrent", "Do you really want to exit µTo", "Button1")
        EndIf

Works perfectly in Windows XP but fails in Windows 7

I had to change it to

Opt("WinTitleMatchMode", 4)

        If WinExists("µTorrent") Then
            WinActivate("µTorrent")
            WinWait("µTorrent")
            ControlClick("µTorrent", "", "Button1")
        EndIf

and it works perfectly.

So it appears as if the text in this and other windows isn't available to AutoIT under Windows 7.

I just wanted to confirm this or find out what mistake I've made.

Thanks in advance!

Share this post


Link to post
Share on other sites



Just a guess, XP is 32bit and Win7 is 64bit?

That was my first guess as the mate i sent it to is Win 7 64Bit.

BUT the test Virtual computer is only Win7 32Bit.

Just curious though why should 64 bit change winexist?

Thanks for the assist

Share this post


Link to post
Share on other sites

It's a DirectUIHWND class window. You won't be able to read text via normal Windows API calls. In XP it most likely uses regular window styles.

Share this post


Link to post
Share on other sites

Afaik to read text from a window, the script has to be run in the same mode as the target program.

But something different:

Opt("WinTitleMatchMode", 4) = Mode 4 (Kept for backward compatibility), Advanced mode, must be replaced with Advanced Window Descriptions which does not need any mode to be set.

Imho this should have no effect at all if you're running 3.3.6.1. , so as you're not using "Advanced Window Descriptions", the Windows are searched with Mode = 1, matches partial titles from the start.

And finally :x... I started µTorrent myself to x-check. The control in the Exit dialog under Win7 which contains the "Do you really want to exit" text is of the class "DirectUIHWND". I would bet that µTorrent utilizes a different class under XP. "DirectUIHWND" is a new control class with Vista (?), which can not be access directly using standard AutoIt techniques.

Share this post


Link to post
Share on other sites

Thanks ALL

I saw a passing refernce to DirectUIHWND but it was a different situation, so I didn't think it applied to this one.

It's going to make it hard to write working programs if programs change their practices on different platforms...sigh

I'll have to make sure that ALL testing is done on XP and 7 now

Thanks for the explaination!

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