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

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



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


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. If you want to start empty script use #Persistent.

Parameters (optional)

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

Title (optional)

Title to use for new script.

Wait (optional)

Milliseconds to wait for new script to start.

General Remarks

ahkFunction Call a function via SendMessage method.
ahkPostFunction Call a function via PostMessage method (does not wait until function returns).
ahkExecuteLine Executes script from given line pointer.
ahkLabel Goto (PostMessage) or Gosub (SendMessage) a Label.
ahkFindFunction Find a function and return its pointer.
ahkFindLabel Find a label and return its pointer.
addFile Add and optionally execute additional script/code from file.
addScript Add and optionally execute additional script/code from text/memory/variable.
ahkExec Execute some script/code from text/memory/variable temporarily.
ahkassign Assign a value to variable or pointer of variable.
ahkgetvar Retrieve a value from a variable.
ahkPause Pause Script.


AhkThread, NewThread, ThreadObj , Objects, DllCall


Thread:=ExeThread("Msgbox `% variable:=`"Thread`"")
While !thread.ahkReady()
  Sleep 100
MsgBox % Thread.ahkgetvar.variable