Looking for documentation of AHK v2.02 functions

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Scryptic
Posts: 16
Joined: 30 Oct 2019, 05:57

Looking for documentation of AHK v2.02 functions

Post by Scryptic » 29 May 2023, 06:45

I find no documentation anywhere online for the functions used in AHK v2 scripts. The Quick Reference included in the installation download only refers to the depricated command syntax, and not to what parameters the functions that have replaced them expect. For example the ControlGetText() function. I want it to work on any text editor in focus at keypress, such as Notepad.

This syntax doesn't work with AHK v2.02:
ControlGetText, OutputVar [, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]

I suppose there is no "OutputVar" parameter for the function ControlGetText(), but that is just a guess, as is how to specify the control from which to read the text. Is there an easier way to find and specify the control that is active when the hotkey is pressed?

Code: Select all

Ins::
{
	FocusedHwnd := ControlGetFocus("A")
	FocusedClassNN := ControlGetClassNN(FocusedHwnd)
	textcontent := ControlGetText(FocusedClassNN)  ; [i]What parameters does this function take?[/i]
	Send(FocusedHwnd)  ; [i]contains: "132654"[/i]
	Send(FocusedClassNN)  ; [i]contains: "Edit1"[/i]
        Send(textcontent) ; [i]Yields: "Error: Target Window not found"[/i]
	Return
}
[Mod edit: [code][/code] tags added.]

[I find AHK extremely difficult to use. I used 4 years ago and managed to get something out of it after having spent lots of time with the cryptic syntax. Now with v2 there's no real documentation anymore.]

gregster
Posts: 8971
Joined: 30 Sep 2013, 06:48

Re: Looking for documentation of AHK v2.02 functions

Post by gregster » 29 May 2023, 07:01

Sure there is v2 documentation. You can use the AHK Docs dropdown at the top of every forum page and choose 'AutoHotkey v2 Help'.
From any v1 docs page header you can also switch to v2 (click v1 and choose v2), and vice versa.
The update of the codeboxes (so that they link to the v2 docs) is still in the works, though.

See eg ControlGetText (v2).

Btw, the v2 installation folder contains the v2 docs (AutoHotkey.chm):

v2 help.png
v2 help.png (54.42 KiB) Viewed 305 times

Post Reply

Return to “Ask for Help (v2)”