![]() ![]() ![]() Examples of their many uses include taking some action when the user becomes idle (as reflected by A_TimeIdle) or closing unwanted windows the moment they appear.Īlthough timers may give the illusion that the script is performing more than one task simultaneously, this is not the case. Timers are useful because they run asynchronously, meaning that they will run at the specified frequency (interval) even when the script is waiting for a window, displaying a dialog, or busy with another task. To change the priority of an existing timer without affecting it in any other way, leave the parameter before this one blank. Otherwise, specify an integer between -21474836483647 (or an expression) to indicate this timer's thread priority. Turning off a timer does not release the object. If the timer is associated with a function object, the object is released. ![]() If the timer exists but was previously set to run-only-once mode (see above), it will again run only once.ĭelete : Disables and deletes an existing timer. If the timer does not exist, it is created (with a default period of 250). On: Re-enables a previously disabled timer at its former period. Its absolute value must be no larger than 4294967295 ms (49.7 days). Period must be an integer, unless a variable or expression is used, in which case any fractional part is ignored. This allows the object to be freed if the script is no longer referencing it, but it also means the timer's Period and Priority are not retained. : If Label is an object created by the script (not an actual function or label), the timer is automatically deleted after the timer function returns, unless the timer was re-enabled. For example, specifying -100 would run the timer 100 ms from now then disable the timer as though SetTimer, Label, Off had been used. : If Period is negative, the timer will run only once. If Period is positive, the timer will automatically repeat until it is explicitly disabled by the script. The timer will be automatically enabled and reset. Period: Creates or updates a timer using the absolute value of this parameter as the approximate number of milliseconds that must pass before the timer is executed. If blank or omitted and the timer already exists, it will be enabled and reset at its former period unless Priority is specified. If blank or omitted and the timer does not exist, it will be created with a period of 250. This parameter must be either given a non-empty value or completely omitted. Note: In, passing an empty variable or an expression which results in an empty value is considered an error. Other expressions which return objects are currently unsupported. : If not a valid label name, this parameter can be the name of a function whose parameter list has no mandatory parameters, as in example #4, or a single variable reference containing a function object, as in example #5. This is useful for timers which launch functions or function objects. : If A_ThisLabel is empty but the current thread was launched by a timer, that timer is used. For example, SetTimer, Off can be used inside a timer subroutine to turn off the timer, while SetTimer, 1000 would either update the current timer's Period or set a new timer using the label which is currently running. ![]() : If Label is omitted, A_ThisLabel will be used. As with the parameters of almost all other commands, Label can be a variable reference such as %MyLabel%, in which case the name stored in the variable is used as the target. The name of the label, hotkey label, or hotstring label to which to jump, which causes the commands beneath Label to be executed until a Return or Exit is encountered. SetTimer, Label, PeriodOnOffDelete, Priority Parameters Label SetTimer - Syntax & Usage | AutoHotkey v1 SetTimerĬauses a subroutine to be launched automatically and repeatedly at a specified time interval. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |