- I could work on it from time to time, or assist, but I'd need to get a foothold.
- Classic functionality would be to retrieve the window title, and text, in Notepad, or the Notepad equivalent.
- In the example below I show how to do this in Notepad via AutoHotkey commands, and then via the DllCall function (the DllCall code can be easily translated into C++).
- I would greatly appreciate if others could provide similar code, in any programming language, for other systems.
- Other basic examples would be appreciated also, such as sending key presses and clicks. And the fundamental example for creating hotkeys: receiving key presses.
- Also, examples of existing programs with any of this functionality would be much appreciated, especially if they are open source.
- And, any examples of window inspectors such as AccViewer (for Windows) would be useful, to get an idea of what text can be retrieved from windows.
Code: Select all
q:: ;Notepad - get window title and Edit control text ;get title/text using built-in commands WinGetTitle, vWinTitle, A ControlGetText, vText, Edit1, A vOutput1 := vWinTitle "`r`n" vText ;get title via DllCall hWnd := DllCall("user32\GetForegroundWindow", Ptr) vChars := 1+DllCall("user32\GetWindowTextLength", Ptr,hWnd) VarSetCapacity(vWinTitle, vChars*2, 0) DllCall("user32\GetWindowText", Ptr,hWnd, Ptr,&vWinTitle, Int,vChars) VarSetCapacity(vWinTitle, -1) ;get text via DllCall vCtlID := 15 ;Edit control ;vCtlID := 1025 ;msctls_statusbar32 control hCtl := DllCall("user32\GetDlgItem", Ptr,hWnd, Int,vCtlID, Ptr) vChars := 1+DllCall("user32\SendMessage", Ptr,hCtl, UInt,0xE, UPtr,0, Ptr,0, Ptr) ;WM_GETTEXTLENGTH := 0xE VarSetCapacity(vText, vChars*2, 0) DllCall("user32\SendMessage", Ptr,hCtl, UInt,0xD, UPtr,vChars, Ptr,&vText, Ptr) ;WM_GETTEXT := 0xD VarSetCapacity(vText, -1) vOutput2 := vWinTitle "`r`n" vText MsgBox, % vOutput1 vScriptName := A_ScriptName DllCall("user32\MessageBox", Ptr,0, Ptr,&vOutput2, Ptr,&vScriptName, UInt,0) return
Linux AutoHotkey version - AutoHotkey Community
We want AHK for Linux! - AutoHotkey Community
GitHub - Paris/IronAHK: Cross platform .NET rewrite of the popular AutoHotkey scripting language for desktop automation.
naming conventions - Why are many ports of languages to .net prefixed with 'Iron'? - Stack Overflow
Can I run AHK on a Mac that is running Windows with Parallels? - AutoHotkey Community
Autohotkey for Mac - AutoHotkey Community
AutoHotKey Equivalent for Mac - AutoHotkey Community
Writing AHK Interpreters for Mac - Any plans for the future / current projects? And other Qs... - AutoHotkey Community