storme Posted January 2, 2011 Share Posted January 2, 2011 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! Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
KaFu Posted January 2, 2011 Share Posted January 2, 2011 Just a guess, XP is 32bit and Win7 is 64bit? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
storme Posted January 2, 2011 Author Share Posted January 2, 2011 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 Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Ascend4nt Posted January 2, 2011 Share Posted January 2, 2011 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. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
KaFu Posted January 2, 2011 Share Posted January 2, 2011 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 ... 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. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
KaFu Posted January 2, 2011 Share Posted January 2, 2011 I should've kept my answer a little shorter : ... happy new year m8 ! OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
storme Posted January 2, 2011 Author Share Posted January 2, 2011 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! Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now