Turning Your Computer on/off, Power Management



POWER-SUSPEND

Puts the system to Standby mode.

To accelerate switch to Suspend mode, use POWER-FORCE immediately before POWER-HIBERNATE.


POWER-HIBERNATE

Puts computer to hibernate mode.

To accelerate switch to Hibernate mode, use POWER-FORCE immediately before POWER-HIBERNATE.


MONITOR-ON
MONITOR-OFF
MONITOR-LOW

These key words, respectively, turn on the monitor, turn it off and switch it to reduced power consumption mode, .


SCREENSAVER-ON
SCREENSAVER-OFF

Starts/stops the screen saver.

SCREENSAVER-OFF only works in WinNT/2000/XP. However, you can usually turn off a screen saver by emulating a mouse movement (see "Mouse Activity Emulation).


SCREENSAVER-ON?

Returns TRUE (-1) if screen saver is started.


SHUTDOWN
FORCE-SHUTDOWN

Shuts down Windows to the point of "It is now safe to turn off your computer ". Word FORCE-SHUTDOWN ignores system queries regarding saving changes in open applications and forces the operating system to shut down.


REBOOT
FORCE-REBOOT

Reboots the system. Word FORCE-REBOOT ignores system queries regarding saving changes in open applications and forces the operating system to reboot.


POWEROFF
FORCE-POWEROFF

Shuts the system down and turns off the power. Word FORCE-POWEROFF ignores system queries regarding saving changes in open applications and forces the operating system to shut down and turns power off.


LOGOFF
FORCE-LOGOFF

Logs off the current user (works in 9x/ME and works in NT/2000/XP if nnCron is running as a regular application rather then as a service). Word FORCE-LOGOFF ignores system queries regarding saving changes in open applications and forcibly logs off the current user.


LOGGEDON?

Returns TRUE (-1) if a user is logged on locally.


INTERCEPT-SHUTDOWN

Intercepts the computer shutdown process if the task was triggered using the word WatchQueryShutdown. Note, please: the word INTERCEPT-SHUTDOWN can not intercept the forced computer shutdown process, which is started for example by the words FORCE-POWEROFF, FORCE-SHUTDOWN, FORCE-REBOOT).

Example:

#( test_no_shutdown
WatchQueryShutdown
Time: * 12-14
Action:
    INTERCEPT-SHUTDOWN
    PAUSE: 2000
    MSG: "Turning off the PC is not allowed from 12:00 to 14:00"
)#

The word INTERCEPT-SHUTDOWN is very useful when you need to perform something right before your computer shutdown: remove temporary files for example. Use the special word CONTINUE-SHUTDOWN or one of the words, which are performing forced shutdown (FORCE-POWEROFF, FORCE-SHUTDOWN, FORCE-REBOOT) to continue the intercepted shutdown process.

Example:

#( test_cleanup
WatchQueryShutdown
Action:
    INTERCEPT-SHUTDOWN
    PAUSE: 2000
    PURGE-OLD: "c:\windows\temp\*" -1
    CONTINUE-SHUTDOWN
)#


CONTINUE-SHUTDOWN

This word continues the computer shutdown process which was intercepted by the word INTERCEPT-SHUTDOWN.

Example:

#( test_last_chance
WatchQueryShutdown
Action:
    INTERCEPT-SHUTDOWN
    PAUSE: 1000
    QUERY: "Do you REALLY want to shut down your PC?"
    IF
        CONTINUE-SHUTDOWN
    ELSE
        MSG: "The shutdown is interrupted!"
    THEN
)#

See also: