sunzen Posted June 3, 2010 Share Posted June 3, 2010 Hi all, I try using controlclick to click button control - after all controlclick seems more reliable and flexible than mouseclick, which require coords of the target contorl. Unfortunately, i find out that controlclick does not work for some button controls. Is there anyone who encounter the same problem with me? How to tackle with it? Thank you for your any information. Sunzen Link to comment Share on other sites More sharing options...
jfcby Posted June 3, 2010 Share Posted June 3, 2010 (edited) Yes, I've run into that same problem and the work around I had to used were Send Keys tab and enter but first you will need to use WinActivate and WinWaitActive. Some really good examples are in the help file. jfcby Edited June 3, 2010 by jfcby Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** Link to comment Share on other sites More sharing options...
KaFu Posted June 3, 2010 Share Posted June 3, 2010 "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()." ... or try something like ControlSend("TargetWin", "", "Button1", "{ENTER}"). 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...
sunzen Posted June 4, 2010 Author Share Posted June 4, 2010 Hi Jfcby & Kafu Thank you for your attention and replies. There was something wrong with the window title, The window title is a little special. Later i used WinTitleMatchMode 2 to just match part of it, and actually it does work when I copy all the characters of windows title from Windows Info tool. However, I still find that there is some limitation when trying to operate control by using ControlClick-like functions. Concretely, It seems that we can not get (correct) ControlID for each program by using Windows Info tool. For example, for Windows Live Messenger, when i use Windows info to recognize ControlID of those essential controls, like ID inputbox, password inputBox, Logon Button, Window Info tool shows all the control have the same ControlID: [CLASS:DirectUIHWND;INSTANCE:2]. Could someone give any opinion? Thanks in advance. Sunzen Link to comment Share on other sites More sharing options...
KaFu Posted June 4, 2010 Share Posted June 4, 2010 Might have different reasons.- Some controls are OS-Architecture sensitive (TreeView, ListView), meaning that the script has to be compiled in line with the OSArch (only x64 au3 scripts can access an 64bit ListView).- The program might use none winapi standard controls, those can only be catched by custom code.Try to apply Ascend4nts excellent UDF _EnumChildWindows on the target window and study the result. 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...
Yoriz Posted June 4, 2010 Share Posted June 4, 2010 Others have had the same problem GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
sunzen Posted June 5, 2010 Author Share Posted June 5, 2010 Hi KaFu,Thank you for your information. I'd like to try Ascend4nt's UDF _EnumChildWindows, but found it is currently not available on his website. Do you have a copy of it ? Thanks. Sunzen Might have different reasons....Try to apply Ascend4nts excellent UDF _EnumChildWindows on the target window and study the result. Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 5, 2010 Share Posted June 5, 2010 sunzen, I just checked, it's still there. Are you clicking on the download link? (its a ZIP file) 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...
sunzen Posted June 5, 2010 Author Share Posted June 5, 2010 Hi Ascend4nt, Thanks for your attention. This makes me get aware of that the access network is restricted. Yeah, it's there. Thanks for your work. I will give it a try. Sunzen Link to comment Share on other sites More sharing options...
sunzen Posted June 5, 2010 Author Share Posted June 5, 2010 Hi KaFu & Ascend4nt, I run the Ascend4nt's UDF to detect controls of Windows Live Messenger. The following is the results. ~~~~~~~~~~~ [0]|Handle|Classname|Control ID|Iteration|Title/Text [1]|0x000407AA|Main Window Native WindowBar Class|0|1| [2]|0x000607BA|DirectUIHWND|0|1| [3]|0x000607A2|Main Window Class|0|1| [4]|0x0014079A|DirectUIHWND|0|2| [5]|0x0004078C|SizableRebar|0|1| [6]|0x0013078A|ReBarWindow32|1999|1| [7]|0x00120786|ToolbarWindow32|0|1| ~~~~~~~~~~~~~ It seems there is not enough information to recognize ControlID for the primary Controls Like ID Entry, Password Entry and Logon Button. Could you give any idea? FYI, The version of Windows Live Messenger is 2009. And Detected by Windows Info tool, ControlID of Password Entry is "[CLASS:DirectUIHWND;INSTANCE:2]". It can be used by ControlSend-like functions to operate this control. Thanks Sunzen Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 5, 2010 Share Posted June 5, 2010 sunzen, Just checked this out myself, and apparently Windows Live Messenger isn't using any standard controls. I don't know how you would interact with something like that. 'DirectUIHWND' sounds like it's using some type of DirectX/3D related interface. Bleh.. I personally like to use the 'aMSN' (Windows Live-compatible) messenger myself. 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...
sunzen Posted June 5, 2010 Author Share Posted June 5, 2010 Hi Ascend4nt, Thank you for your comment and suggestion of aMSN. My code snippet is as following. Password can be entered when using the ControlSend way. Func Password_Input() $pswd="XXXXX" $way=0 Switch $way Case 0 $PswdCtrlID="[CLASS:DirectUIHWND;INSTANCE:2]" ControlClick($Mtitle,"",$PswdCtrlID) Sleep(1000) ControlSend($Mtitle,"",$PswdCtrlID,$pswd) Sleep(2000) Case 1 Send("{TAB}") Send($pswd) Sleep(2000) EndSwitch EndFunc Func Logon_Click() $way = 2 Switch $way ; navigate to logon button control via Tab key Case 0 TabKey_PressN(7) Send("{ENTER}") ; Case 1 ; Is not able to get the correct ControlID for the logon button. $OkID="[CLASS:DirectUIHWND;INSTANCE:2]" ControlClick($Mtitle,"",$OkID) ; Type {Enter} just after password is entered Case 2 Send("{ENTER}") EndSwitch EndFunc I tried to draw a conclusion about the limitations, but found the very note in the manual. AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment! Thank all of you for making me finally pay attention to the critical note. Sunzen Link to comment Share on other sites More sharing options...
sunzen Posted June 5, 2010 Author Share Posted June 5, 2010 HiThank you for your kindness and information. This is a broader and interesting topic, learning ...ThanksSunzenOthers have had the same problem Link to comment Share on other sites More sharing options...
KaFu Posted June 5, 2010 Share Posted June 5, 2010 Sounds like a really none-trivial task which nobody on this forum has really mastered yet ... http://www.autoitscript.com/forum/index.php?showtopic=93315&view=findpost&p=671487 http://www.codeproject.com/KB/macros/wlmplugin.aspx 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...
Ascend4nt Posted June 5, 2010 Share Posted June 5, 2010 (edited) oy Kafu,, now my head hurts . DirectUI directly 'draws controls and widgets on the screen', that's just wonderful... for skinning, I guess. lol. I read somewhere that Windows 7 apps are starting to use this more.. I really hope not - or that someone comes up with a workable solution. Happily, I'm not working with any DirectUI apps regularly, so I'm putting it out of mind for the time being sunzen, I'm glad you found that ControlSend works for you... I would just be concerned about the wrong control being active when you use it. *edit: to clarify, the "[CLASS:DirectUIHWND;INSTANCE:2]" refers to the whole inner client area of Windows Live messenger, including all the 'DirectUI' controls inside of it. You can see this clearly by using the AutoIT Window Info tool and running it across the whole inner area. Edited June 5, 2010 by Ascend4nt 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...
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