ahkassign

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")

Parameters

OutputVar

The name of the variable in which to store the result, -1 on failure and 0 on success.

VarName

Name of the variable to assign value to.

Value

Value as String.

Related

ahkFindFunc, ahkFindLabel, ahkgetvar, NewThread

Examples

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