ahkLabel

Exported function that allows calling a Label in script currently executed by AutoHotkey module.
Paramenters can be strings only as well as return value.


OutputVar := DllCall("Module\ahkLabel", "Str", "LabelName", "UInt", DoNotWait, "CDecl Int")
Function Example: OutputVar := DllCall("AutoHotkey.dll\ahkLabel", "Str", "MyLabel", "UInt", 0, "CDecl Int")
                  OutputVar := DllCall("AutoHotkey.exe\ahkLabel", "Str", "MyLabel", "UInt", 0, "CDecl Int")

Parameters

OutputVar

The name of the variable to store 1 / true if label was found or 0 / false otherwise.

LabelName

The name of the label to jump to.

DoNotWait

1 (true) will not wait for the code to finish / return, FALSE / NULL / 0 will wait for execution to finish like GoSub does.

Related

ahkPostFunction, ahkFindFunc, DllCall

Examples

dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","
(
#Persistent
Return
MyLabel:
MsgBox % A_ThisLabel
Return
)","Str","","CDecl") ; start a new thread, just the function.
DllCall(dllpath "\ahkLabel","Str","MyLabel","UInt",0,"CDecl") ; jump to label and wait for it to finish / return.

; Same example like above using included AutoHotkey.dll
dll:=AhkThread("
(
#Persistent
Return
MyLabel:
MsgBox % A_ThisLabel
Return
)")
dll.ahkLabel["MyLabel"]