NewThread()

Auto Hotkey

NewThread

Create a real additional AutoHotkey thread in current process using Thread Local Storage (without using AutoHotkey.dll).
The main difference to AutoHotkey.dll thread is that a TLS thread shares the hook between all threads and uses one pool of Hotkeys and Hotstrings, so if you have same hotkey in main thread and TLS thread you will get a duplicate Hotkey error.


OutputVar := NewThread(Script , Parameters, Title)
Command  Example: NewThread "MsgBox Message from thread."
Function Example: ThreadID := NewThread("MsgBox Message from thread.")

Parameters

OutputVar

The name of the variable in which to store the ThreadID 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.

Related

AhkThread, ExeThread, ThreadObj , Objects, DllCall

Examples

NewThread("Msgbox `% variable:=`"Thread`"")