General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

MACRO IDLE


Ever since IDLE was mentioned in the rather humorous context of COW 165 we have suspected a feeling among some users that the IDLE macro is for idle minds when no serious task is at hand.

We're not prepared to argue against that, but it's time to point out that IDLE refers not to the user but to the program and the computer. Simply put, the IDLE macro is executed automatically when GHS is not too busy doing something else. When waiting for input, GHS is "idle." At such times it checks for the existence of a macro named IDLE and executes it if found.

Whether or not a macro named IDLE exists is up to you, the user -- maybe not from something you did directly if it was generated from within some kind of run file.

For example, the commands that execute behind the scenes in GHS Load Monitor (GLM) use an IDLE macro to monitor certain aspects of the load condition.

Normally, IDLE gets executed at one-second intervals, but this is adjustable by the WAIT IDLE command. WAIT IDLE 0.1 would cause macro IDLE to automatically execute up to ten times per second. WAIT IDLE 0 means GHS will execute it as often as possible during its idle time, in which case GHS is not idle at all as it repeatedly obeys whatever commands are in the IDLE macro.

Beware! Wait IDLE 0 might make it impossible to break out of the idle cycle. You see, normally you have a chance to delete macro IDLE by defining it as empty:
MACRO IDLE
/
But if there is no time between IDLE cycles, there may be no way to delete the macro.

Someone might use this fact to implement a password and keep someone else with idle curiosity from messing with GHS, simply by putting this at the beginning of GHS.LF:
variable (str) password
wait idle 0
macro idle
input password
`The comma at the end of the next line is required!
if "{password}"="ABC123" then exit | mac idle | /,
wait idle 1 | clear (password) var
/
Note that the password is not case sensitive.



Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs