Exported function that assigns a string value to a variable in currently executed script.
OutputVar := DllCall("Module\ahkassign", "Str", "VarName", "Str", Value, "CDecl UInt")
Command Example: DllCall "AutoHotkey.dll\ahkassign", "Str", "Variable", "Str", "100", "CDecl UInt"
DllCall "AutoHotkey.exe\ahkassign", "Str", "Variable", "Str", "100", "CDecl UInt"
Function Example: Result := DllCall("AutoHotkey.dll\ahkassign", "Str", "Variable", "Str", "100" ,"CDecl UInt")
Result := DllCall("AutoHotkey.exe\ahkassign", "Str", "Variable", "Str", "100", "CDecl UInt")
The name of the variable in which to store the result, -1 on failure and 0 on success.
Name of the variable to assign value to.
Value as String.
ahkFindFunc, ahkFindLabel, ahkgetvar, NewThread
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
ThreadID:=DllCall(dllpath "\NewThread","Str","","Str","","Str","","CDecl") ; start a new thread from file.
DllCall(dllpath "\ahkassign","Str","var","Str","value","Uint",ThreadID,"CDecl") ; assing value to var
MsgBox DllCall(dllpath "\ahkgetvar","Str","var","UInt",0,"Uint",ThreadID,"CDecl") ; wait for the thread to exit
; Same example like above using NewThread function.
dll:=NewThread(,,,,dllpath)
dll.ahkassign("var","value")
MsgBox dll.ahkgetvar.var