ahkFindLabel

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


OutputVar := FindLabel("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, ahkFindFunc

Examples

; AHK_H Structures
global _AHKDerefType := "LPTSTR marker,{_AHKVar *var,_AHKFunc *func,_AHKDerefType *next,UInt symbol,int int_value},BYTE type,BYTE substring_count,UInt length"
global _AHKCallSite := "PTR *func, LPTSTR member, int flags, int param_count"
global _AHKExprTokenType := "{__int64 value_int64,double value_double,struct{{PTR *object,_AHKCallSite *callsite,_AHKDerefType *var_deref,_AHKVar *var,LPTSTR marker,_AHKExprTokenType *circuit_token},{_AHKCallSite *outer_param_list,LPTSTR error_reporting_marker,size_t marker_length, int var_usage}}},UINT symbol"
global _AHKArgStruct := "BYTE type,bool is_expression,UInt length,LPTSTR text,_AHKDerefType *deref,_AHKExprTokenType *postfix, int max_stack, max_alloc"
global _AHKBreakPoint := "INT id,BYTE type,BYTE state,bool temporary"
global _AHKLine := "BYTE mActionType,mArgc,WORD mFileIndex,UINT mLineNumber,_AHKArgStruct *mArg,PTR *mAttribute,_AHKLine *mPrevLine,*mNextLine,*mRelatedLine,*mParentLine,_AHKBreakPoint *mBreakPoint"
global _AHKLabel := "LPTSTR mName,_AHKLine *mJumpToLine,_AHKLabel *mPrevLabel,*mNextLabel"
global _AHKFuncParam := "_AHKVar *var,WORD is_byref,default_type,{LPTSTR default_str,Int64 default_int64,Double default_double}"
If (A_PtrSize = 8)
	global _AHKRCCallbackFunc := "UINT64 data1,data2,BYTE actual_param_count,flags,PTR *func"
else
	global _AHKRCCallbackFunc := "BYTE actual_param_count,flag,PTR *func"
global _AHKFuncItemList := "_AHKUserFunc **mItem,int mCount, mCountMax"
global _AHKVarItemList := "_AHKVar **mItem,int mCount, mCountMax"
global _AHKFunc := "PTR vtable,v1,v2,v3,v4,v5,v6,v7,v8,LPCTSTR mName,int mParamCount,mMinParams,mIsVariadic,PTR *mBIF"
global _AHKUserFunc := "PTR vtable,v1,v2,v3,v4,v5,v6,v7,v8,LPCTSTR mName, int mParamCount,mMinParams,mIsVariadic,PTR *mBIF,int mInstances,_AHKLine *mJumpToLine,_AHKFuncParam *mParam,PTR *mClass,_AHKLabel *mFirstLabel,*mLastLabel,_AHKUserFunc *mOuterFunc,_AHKFuncItemList mFuncs,_AHKVarItemList mVars, _AHKVarItemList mStaticVars, _AHKVar **mDownVar, *mUpVar,Int *mUpVarIndex, mDownVarCount, mUpVarCount,bool mIsFuncExpression, BYTE mDefaultVarType,bool mIsMacro,PTR *mdyna_param,bool mPreprocessLocalVarsDone"
global _AHKVar := A_PtrSize ":{Int64 mContentsInt64,Double mContentsDouble,PTR mobject,PTR mVV},{char *mByteContents,LPTSTR mCharContents},{UINT_PTR mByteLength,_AHKVar *mAliasFor},UINT_PTR mByteCapacity,BYTE mHowAllocated,mAttrib,mScope,mType,LPTSTR mName"

Start:
label:=Struct(_AHKLabel,FindLabel("Start"))
MsgBox "Name:`t`t" label.mName "`nFirst Label Line:`t" label.mJumpToLine.mLineNumber "`nArg count:`t" label.mJumpToLine.mArgc "`nFirst Arg:`t`t" label.mJumpToLine.mArg.1.text "`nSecond Arg:`t" label.mJumpToLine.mArg.2.text