Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

DESCRIPTION:

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.

10.9 DISPATCH

FORMAT:


        DISPATCH str_expr 
             . 
             . 
             . 
        target 
             --- 
             ---  block of code 
             --- 
        END ROUTINE 

EXAMPLE:

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... 

PURPOSE:

DISPATCH executes a routine that the program determines at runtime.

DESCRIPTION:

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.


Chapter 11
Set and Ask Statements

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 more information:

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.

11.1 SET AUTOEXIT

FORMAT:


        SET AUTOEXIT num_expr 

EXAMPLE:

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 

PURPOSE:

SET AUTOEXIT slowly backs a user out of a program if the computer is left idle.

DESCRIPTION:

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.

11.2 SET BACK ON | OFF

11.2.1 SET BACK ON

FORMAT:


        SET BACK ON 

Note

The [Esc] key or the [up arrow] key will set _BACK to TRUE.

EXAMPLE:

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 

DESCRIPTION:

SET BACK ON sets the internal variable _BACK to TRUE (1).

11.2.2 SET BACK OFF

FORMAT:


        SET BACK OFF 

EXAMPLE:

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 

DESCRIPTION:

SET BACK OFF sets the internal variable _BACK to FALSE (0).

11.3 SET ERROR ON | OFF

11.3.1 SET ERROR ON

FORMAT:


        SET ERROR ON 

EXAMPLE:

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 

PURPOSE:

SET ERROR ON is used to set the _ERROR flag on.

DESCRIPTION:

_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:

11.3.2 SET ERROR OFF

FORMAT:


        SET ERROR OFF 

EXAMPLE:

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 

PURPOSE:

SET ERROR OFF is used to clear the _ERROR flag.

DESCRIPTION:

_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:

11.4 ASK ERRORS

FORMAT:


        ASK ERRORS num_var 

EXAMPLE:

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 

DESCRIPTION:

ASK ERRORS asks for the number of user errors. The MESSAGE ERROR: statement increments this internal counter.

11.5 SET EXIT ON | OFF

11.5.1 SET EXIT ON

FORMAT:


        SET EXIT ON 

EXAMPLE:

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 

DESCRIPTION:

SET EXIT ON sets the internal variable _EXIT to TRUE (1).

11.5.2 SET EXIT OFF

FORMAT:


        SET EXIT OFF 


Previous Next Contents Index