ahkFindLabel()

Auto Hotkey

ahkFindLabel

Exported function that finds a label in currently executed script and returns a pointer to it.

OutputVar := ahkFindLabel("LabelName")
Function Example: OutputVar := DllCall("AutoHotkey.dll\ahkFindLabel", "Str", "LabelName", "PTR")
                  OutputVar := DllCall("AutoHotkey.exe\ahkFindLabel", "Str", "LabelName", "PTR")

Parameters

OutputVar

The name of the variable to store the label pointer in or 0 if the label was not found.

LabelName

Name of the label to find.

Related

ahkFunction, ahkPostFunction, ahkFindLabel, DllCall

Examples

dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","#Persistent`nMyLabel:`nReturn","Str","","CDecl") ; start a new thread, just the function.
MsgBox % DllCall(dllpath "\ahkFindLabel","Str","MyLabel","CDecl PTR") ; call the function and display pointer in MsgBox.

; Same example like above using included AutoHotkey.dll
dll:=AhkThread("#Persistent`nMyLabel:`nReturn")
MsgBox % dll.ahkFindLabel["MyLabel"]

; Find label in current thread
MsgBox % ahkFindLabel("MyLabel")