Display and Input

 

Next Topic

 

The WIL Tutorial

§         Topic by Topic

§         The Tutorial Course

§         The Complete WIL Tutorial

 

Getting started

Using WIL

Reference

Notes

 

Here we have functions which display information to the user and prompt the user for information, plus a couple of relevant system functions.

Display (seconds, title, text)

Displays a message to the user for a specified period of time. The message will disappear after the time expires, or after any keypress or mouse click.

Example:

Display(2, "Please wait", "Loading Solitaire now")

 

image\tutbut4_shg.gif

 

Message (title, text [, addl-text [, buttons [, icons ]]] )

This command displays a message box with a title and text you specify, which will remain on the screen until the user presses the OK button.

 

Example:

Message("Sorry", "That file cannot be found")

 

image\tutbut5_shg.gif

 

Pause (title, text)

This command is similar to Message, except an exclamation-point icon appears in the message box, and the user can press OK or Cancel. If the user presses Cancel, the WIL program ends (or goes to the label :cancel, if one is defined).

 

Example:

Pause("Delete Backups", "Last chance to stop!")
; if we got this far, the user pressed OK
FileDelete("*.bak")

 

image\tutbut6_shg.gif

AskYesNo (title, question)

Displays a dialog box with a given title, which presents the user with three buttons: Yes, No, and Cancel. If the user presses Cancel, the WIL program ends (or goes to the label :cancel, if one is defined). Otherwise, the function returns a value of @YES or @NO.

 

Example:

response = AskYesNo("End Session", "Really quit Windows?")

 

image\tutbut7_shg.gif

AskLine (title, prompt, default [,format])

Displays a dialog box with a given title, which prompts the user for a line of input. Returns the default if the user just presses the OK button.

 

Example:

yourfile = AskLine("Edit File", "Filename:", "newfile.txt", 0)
Run("notepad", yourfile)

 

image\tutbut8_shg.gif

 

If you specify a default value (as we have with NEWFILE.TXT), it will appear in the response box, and will be replaced with whatever the user types. If the user doesn't type anything, the default is used.

 

Beep

Beeps once.

Beep

 

And if one beep isn't enough for you:

Beep
Beep
Beep

 

TimeDelay (seconds)

Pauses WIL program execution.

The TimeDelay function lets you suspend processing for a fixed period of time, which can be anywhere from 1 to 3600 seconds.