#MaxThreads

Sets the maximum number of simultaneous threads.

#MaxThreads Value

Parameters

Value

Type: Integer

The maximum total number of threads that can exist simultaneously. Specifying a number higher than 255 is the same as specifying 255.

Remarks

This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.

Although a value of 1 is allowed, it is not recommended because it would prevent new hotkeys from launching whenever the script is displaying a MsgBox or other dialog. It would also prevent timers from running whenever another thread is sleeping or waiting.

The OnExit callback function will always launch regardless of how many threads exist.

If this setting is lower than #MaxThreadsPerHotkey, it effectively overrides that setting.

If this directive is unspecified in the script, it will behave as though set to 10.

Related

#MaxThreadsPerHotkey, Threads, #MaxHotkeysPerInterval, #HotkeyInterval, ListHotkeys

Examples

#1

#MaxThreads 2