medic Posted July 27, 2009 Share Posted July 27, 2009 Hi guys. I am using AutoIt3 from withhin one of my programs to send keys to other programs. My question is: I already have the window handle (integer value) in my program. Can I now write that value into a script file automatically or do I have to use the WindowGetHandle() function? Link to comment Share on other sites More sharing options...
MDCT Posted July 27, 2009 Share Posted July 27, 2009 Hi guys.I am using AutoIt3 from withhin one of my programs to send keys to other programs. My question is:I already have the window handle (integer value) in my program. Can I now write that value into a script file automatically or do I have to use the WindowGetHandle() function?Window handle is assigned uniquely or randomly when a window is created. So, next time if you execute a process, the process' window-handle will most likely be different than before. Therefore, it is needed to get the handle each time to make sure that the handle is correct.If you want you could use Window class name but, 2 windows can have the same class name, like notepad windows. Or you could use window title. And I suggest, use AutoIt AU3Info tool to check things. Good luck. Link to comment Share on other sites More sharing options...
medic Posted July 27, 2009 Author Share Posted July 27, 2009 Window handle is assigned uniquely or randomly when a window is created. So, next time if you execute a process, the process' window-handle will most likely be different than before. Therefore, it is needed to get the handle each time to make sure that the handle is correct.If you want you could use Window class name but, 2 windows can have the same class name, like notepad windows. Or you could use window title. And I suggest, use AutoIt AU3Info tool to check things. Good luck.Yeah I know that. I already retrieve the target window's handle at runtime and only milliseconds later I want to use the very same handle in the AutoIt script. So my question is: can I just write it into the autoIt script? Link to comment Share on other sites More sharing options...
MDCT Posted July 28, 2009 Share Posted July 28, 2009 So my question is: can I just write it into the autoIt script? Yes you can. Example the handle is: 0x1234e. You need to use WinGetHandle("0x1234e") first. Here's the script example: $a= InputBox("","Insert Handle") $a=WinGetHandle($a) Msgbox(0,0,WinGetTitle($a,"")) Link to comment Share on other sites More sharing options...
Ascend4nt Posted July 28, 2009 Share Posted July 28, 2009 All that's needed is casting the number with (HWnd(0x1234e)), but still be aware it will stop working when you close the program window. 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