akn Posted February 20, 2009 Share Posted February 20, 2009 Hello,I have to click a static text which is on a windows gui application (built on c#), click takes to another window. Tried with ControlClick() and with MouseClick() after getting the x & y coordinates using ControlGetPos(), but no luck :-( am clueless how to do static text clicks.Plz. find the below summary for Window and Control, which I should click>>>> Window <<<<Title: ScanWindowClass: WindowsForms10.window.8.app.0.201d787Position: 379, 6Size: 650, 411Style: 0x1EC80000ExStyle: 0x00050500Handle: 0x0002050C>>>> Control <<<<Class: WindowsForms10.STATIC.app.0.201d787Instance: 2ClassnameNN: WindowsForms10.STATIC.app.0.201d7872Advanced (Class): [CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]ID: 459988Text: EditPosition: 557, 133Size: 25, 15ControlClick Coords: 17, 7Style: 0x5601000DExStyle: 0x00000000Handle: 0x000704D4Thoughts/workarounds/suggestion are highly appreciated.Thanks in AdvanceRegards,--AK. Link to comment Share on other sites More sharing options...
Ascend4nt Posted February 20, 2009 Share Posted February 20, 2009 ControlClick(HWnd(0x0002050C),"","[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]") Since the handle will change, you can change the first parameter to either the window title ("ScanWindow") or it's classname: "[CLASS:WindowsForms10.window.8.app.0.201d787]" 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...
akn Posted February 20, 2009 Author Share Posted February 20, 2009 ControlClick(HWnd(0x0002050C),"","[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]") Since the handle will change, you can change the first parameter to either the window title ("ScanWindow") or it's classname: "[CLASS:WindowsForms10.window.8.app.0.201d787]" Thanks for your quick reply. Tried but no luck :-) Any more thoughts??? Link to comment Share on other sites More sharing options...
BrettF Posted February 20, 2009 Share Posted February 20, 2009 Try this: $hWND = WinGetHandle ("ScanWindow") $hControl = ControlGetHandle ($hWND, "", "[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]") $ret = ControlClick ($hWND, "", $hControl) MsgBox (0, "", $ret) I'm not entirely sure if what is returned by AutoIt window is correct. Are you sure you're getting the right things from the window? Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
akn Posted February 26, 2009 Author Share Posted February 26, 2009 Try this: $hWND = WinGetHandle ("ScanWindow") $hControl = ControlGetHandle ($hWND, "", "[CLASS:WindowsForms10.STATIC.app.0.201d787; INSTANCE:2]") $ret = ControlClick ($hWND, "", $hControl) MsgBox (0, "", $ret) I'm not entirely sure if what is returned by AutoIt window is correct. Are you sure you're getting the right things from the window? Cheers, Brett $ret = ControlClick ($hWND, "", $hControl), does return 1 - success, whereas it does not simulate click event on the linked text (Edit) Any more thoughts??? Regards, --AK Link to comment Share on other sites More sharing options...
Shibin Posted July 20, 2009 Share Posted July 20, 2009 (edited) I get the same trouble, who can help me? Thanks in Advance. The Window and Contrl info as below: >>>> Window <<<< Title: ImageViewer Class: #32770 Position: 64, 35 Size: 1026, 872 Style: 0x94CA00C4 ExStyle: 0x00050111 Handle: 0x00180722 >>>> Control <<<< Class: Static Instance: 7 ClassnameNN: Static7 Advanced (Class): [CLASS:Static; INSTANCE:7] ID: 1033 Text: Position: 249, 645 Size: 162, 162 ControlClick Coords: 50, 61 Style: 0x5000100E ExStyle: 0x00020004 Handle: 0x0009073A Edited July 20, 2009 by Shibin Link to comment Share on other sites More sharing options...
trung0407 Posted July 20, 2009 Share Posted July 20, 2009 Are you sure it's a standard window label or it's an user made, custom label? The classnameNN looks weird Link to comment Share on other sites More sharing options...
DarkGUNMAN Posted October 5, 2010 Share Posted October 5, 2010 I got around this problem using ControlSend: ControlSend($WindowTitle,"","[CLASS:WindowsForms10.STATIC.app.0.2004eee; INSTANCE:40]","{ENTER}") 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