RunAt


Runs an external program at a specific time or when an event occurs.

RunAt, Target, [Parameter] , EventType, Eventname

Parameters

Target

A document, URL, executable file (.exe, .com, .bat, etc.), shortcut (.lnk), or system verb to launch (see remarks). If Target is a local file and no path was specified with it, A_WorkingDir will be searched first. If no matching file is found there, the system will search for and launch the file if it is integrated ("known"), e.g. by being contained in one of the PATH folders.

Parameter Parameter for the Target. You can leave this empty
EventType
CNT_EVENT System event notification.
CNT_TIME Time-based notification.
CNT_DELETE
Removes an existing event
Eventname If EventType is CNT_TIME this parameter must be a valid datetime in the format YYYYMMDDHHMM

if EventType is CNT_DELETE this parameter should be empty

Following values are valid if EventType is CNT_EVENT:
NOTIFICATION_EVENT_DEVICE_CHANGE A PC Card device changed.
NOTIFICATION_EVENT_IR_DISCOVERED The device discovered a server by using infrared communications.
NOTIFICATION_EVENT_NET_CONNECT The device connected to a network.
NOTIFICATION_EVENT_NET_DISCONNECT The device disconnected from a network.
NOTIFICATION_EVENT_NONE No events occurred. Remove all event registrations for this application.
NOTIFICATION_EVENT_OFF_AC_POWER The user turned the alternating current (AC) power off.
NOTIFICATION_EVENT_ON_AC_POWER The user turned the AC power on.
NOTIFICATION_EVENT_RESTORE_END A full device data restore completed.
NOTIFICATION_EVENT_RS232_DETECTED An RS232 connection was made.
NOTIFICATION_EVENT_SYNC_END Data synchronization finished.
NOTIFICATION_EVENT_TIME_CHANGE The system time changed.
NOTIFICATION_EVENT_TZ_CHANGE The time zone changed.
NOTIFICATION_EVENT_WAKEUP The device woke up.

ErrorLevel

errorlevel is 0 if the call succeeded, 1 otherwise

Remarks

Related

RunAs, Process, Exit, CLSID List, DllCall

Examples

;runs pword at the given date and time
RunAt, \windows\pword.exe, , CNT_TIME, 201009040243

;runs calc after the device is powered on from sleeping
RunAt, \windows\calc.exe, , CNT_EVENT , NOTIFICATION_EVENT_WAKEUP

;Deletes the queue
RunAt, \windows\pword.exe, , CNT_DELETE
RunAt, \windows\calc.exe, , CNT_DELETE