ThreadObj

Create a real additional AutoHotkey thread in current process without using AutoHotkey.dll (based on NewThread).


OutputVar := ThreadObj(Script , Parameters, Title)
Function Example: Thread := ThreadObj("MsgBox Message from thread.")

Parameters

OutputVar

The name of the variable in which to store the Thread object for newly created thread.

Script

The AutoHotkey script to execute as string or variable containing a string. If you want to start a script from file simply use #Include directive.

Parameters (optional)

Command line parameters that will be available in built-in variable A_Args object.

Title (optional)

Title to use for new script.

Methods
MsgBox % thread.variable ; get a variable value
thread.variable:=Value ; set a variable value
ReturnValue := thread.Call("FunctionName", parameters...)
hread.PostCall("FunctionName", parameters...)
thread.FuncPtr("FunctionName")
thread.LabalPtr("LabelName")
thread.Exec("MsgBox Script")
thread.AddFile("FilePath", Execute)
thread.AddScript("MsgBox Script", Execute)
thread.GotoLabel("Label")
thread.GoSubLabel("Label")
thread.ExitApp()

Related

AhkThread, NewThread, ExeThread , Objects, DllCall

Examples

Thread:=ThreadObj("Msgbox `% variable:=`"Thread`"")
MsgBox % thread.variable