Previous | Contents | Index |
The PASS URL statement can be used to open any webpage, either local or remote. A new browser window is opened by PASS URL. If the URL references a filetype handled by an external program (such as an .AVI movie file), then the appropriate external program will be run (such as the Windows Media Player).
By using the PASS URL statement, web-based applications and multi-media features can be integrated into Sheerpower applications.
DISPATCH str_expr . . . target --- --- block of code --- END ROUTINE |
Example 10-39 DISPATCH Statement |
---|
input 'Routine name', default 'add_info': routine$ dispatch routine$ stop routine add_info print 'Adding information...' end routine change_info print 'Changing information...' end Routine name? add_info Adding information... |
DISPATCH executes a routine that the program determines at runtime.
DISPATCH looks at the contents of the string expression (str_expr), searches for a routine with that name and goes to the routine.
str_expr is the name of the subroutine to execute.
SET and ASK statements find and change characteristics within a Sheerpower program. SET sets various characteristics, and ASK returns the value of various characteristics. SET and ASK have several different options.
SET and ASK can be used on a channel of a device. SET and ASK are used to do special printing to the screen. ASK is used to find the screen's current print zone width and right margin setting. If they are not correct, SET is used to change them and then print your information to the screen.
For information on SET #chnl and ASK #chnl statements, refer to Chapter 14, File Handling. For information on SET TABLE and ASK TABLE statements, refer to Chapter 15, Data Table Statements. |
SET AUTOEXIT num_expr |
Example 11-1 SET AUTOEXIT |
---|
set autoexit 1 do input 'Who': a$ if _exit or _back then exit do loop print 'Finished' end Who? Greg Who? Sammy Who? (when user fails to respond within 1 minute.) Finished |
SET AUTOEXIT slowly backs a user out of a program if the computer is left idle.
SET AUTOEXIT causes an idle terminal waiting at an input prompt to set _EXIT to TRUE and complete the input. num_expr is the length of time in minutes. If num_expr is assigned a value of 0, Sheerpower turns off the feature.
If the terminal is left idle for num_expr minutes at the input prompt, EXIT will be forced as the response, the _EXIT flag will be set to on and the program will execute the code indicated for _EXIT, if any.
SET BACK ON |
The [Esc] key or the [up arrow] key will set _BACK to TRUE. |
Example 11-2 SET BACK ON statement |
---|
line input 'Name', length 30: reply$ print _back set back on print _back end Name? TESTER________________________ 0 1 |
SET BACK OFF |
Example 11-3 SET BACK OFF Statement |
---|
line input 'Name', length 30: reply$ print _back set back off print _back end Name? [Esc]_____________________________ <--- press the Escape key or Up arrow key 1 0 |
SET ERROR ON |
Example 11-4 SET ERROR ON Statement |
---|
do input 'Enter the age': age if age < 1 then print 'Too young:'; age set error on else set error off end if loop while _error end Enter the age? .5 Too young: .5 Enter the age? 38 |
SET ERROR ON is used to set the _ERROR flag on.
_ERROR is a general purpose error flag. It is used to indicate that an error has occurred, and to test later whether an error has occurred.
The following statements SET the _ERROR flag:
SET ERROR OFF |
Example 11-5 SET ERROR OFF Statement |
---|
do input 'Enter the age': age if age < 1 then print 'Too young:'; age set error on else set error off end if loop while _error end Enter the age? .5 Too young: .5 Enter the age? 38 |
SET ERROR OFF is used to clear the _ERROR flag.
_ERROR is a general purpose error flag. You can use it to indicate that an error has occurred, and to test later whether an error has occurred.
The following statements CLEAR the _ERROR flag:
ASK ERRORS num_var |
Example 11-6 ASK ERRORS Statement |
---|
do input 'Enter the age': age if age < 1 then message error: age; ' Too Young' repeat do else exit do end if loop ask errors num_errors print 'Errors:'; num_errors end Enter the age? 0 0 Too Young Enter the age? .5 .5 Too Young Enter the age? 21 Errors: 2 |
ASK ERRORS asks for the number of user errors. The MESSAGE ERROR: statement increments this internal counter.
SET EXIT ON |
Example 11-7 SET EXIT ON Statement |
---|
line input 'Name', length 30: reply$ print _exit set exit on print _exit end Name? ELAINE________________________ 0 1 |
SET EXIT OFF |
Previous | Next | Contents | Index |