Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

11.14 ASK | SET SEED

FORMAT:


        ASK SEED num_var 
        SET SEED num_expr 

EXAMPLE:

Example 11-19 ASK/SET SEED Statement

  randomize
  ask seed seed_num 
  for i = 1 to 3 
    print rnd(1000) 
  next i 
  print 'Reset the random sequence' 
  set seed seed_num 
  for i = 1 to 3 
    print rnd(1000) 
  next i 
  end
 
 
608 
88 
506 
Reset the random sequence 
608 
88 
506 

PURPOSE:

ASK SEED sets or resets the pseudo-random number sequence.

DESCRIPTION:

ASK SEED returns the current starting point of a pseudo-random sequence and stores the number in num_var.

SET SEED sets the starting point of a pseudo-random sequence with the number in num_expr.

11.15 ASK | SET SYSTEM

There are a number of ASK SYSTEM and SET SYSTEM statements. These are described in the following sections. The ASK/SET statements ask about and set various system operation features.

11.15.1 ASK | SET SYSTEM: CLIPBOARD

FORMAT:


        [ASK | SET] SYSTEM: CLIPBOARD str_var 

EXAMPLE:

Example 11-20 ASK | SET SYSTEM: CLIPBOARD Statement

  set system: clipboard 'This is some sample text to put into your clipboard.' 
  ask system: clipboard clip$ 
  print clip$ 
  end

EXAMPLE:

Example 11-21 ASK | SET SYSTEM: CLIPBOARD Statement

  last_clip_text$ = '' 
  do
    delay .02  // no need to run too quickly 
    ask system: clipboard clip_text$ 
    if clip_text$ = last_clip_text$ then repeat do
    last_clip_text$ = clip_text$ 
    new_clip_text$ = trim$(clip_text$) // remove leading and trailing spaces 
    if new_clip_text$ = clip_text$ then repeat do // nothing to do 
    last_clip_text$ = new_clip_text$ 
    set system: clipboard new_clip_text$ 
  loop
  end

DESCRIPTION:

ASK | SET SYSTEM: CLIPBOARD allows you to get and store clipboard text.

11.15.2 ASK SYSTEM: COMMENT

FORMAT:


        ASK SYSTEM: COMMENT str_var 

EXAMPLE:

Example 11-22 ASK SYSTEM: COMMENT Statement

  set system: comment 'Invoice Entry' 
  ask system: comment c$ 
  print c$ 
  end
 
 
Invoice Entry 

DESCRIPTION:

The ASK SYSTEM: COMMENT statement asks for the Sheerpower operating system comment for the process.

11.15.3 SET SYSTEM: COMMENT

FORMAT:


        SET SYSTEM: COMMENT str_expr 

EXAMPLE:

Example 11-23 SET SYSTEM: COMMENT Statement

  set system: comment 'Invoice Entry' 
  ask system: comment c$ 
  print c$ 
  end
 
 
Invoice Entry 

11.15.4 ASK SYSTEM: DIRECTORY

FORMAT:


        ASK SYSTEM: DIRECTORY str_var 

EXAMPLE:

Example 11-24 ASK SYSTEM: DIRECTORY Statement

  ask system: directory z$ 
  print 'Current directory is: '; z$ 
  end
 
 
 Current directory is: c:/sheerpower 

DESCRIPTION:

ASK SYSTEM: DIRECTORY asks the operating system for the current default device and directory.

11.15.5 SET SYSTEM: DIRECTORY

FORMAT:


        SET SYSTEM: DIRECTORY str_var 

Important note on the following example:

The following example assumes that you have a folder named "samples" inside of your Sheerpower folder (\Sheerpower\samples).

EXAMPLE:

Example 11-25 SET SYSTEM: DIRECTORY Statement

  ask system: directory z0$ 
  print 'Current directory     '; z0$ 
  set system: directory 'c:\sheerpower\samples' 
  ask system: directory z1$ 
  print 'Directory set to      '; z1$ 
  delay 2 
  set system: directory z0$ 
  print 'Directory set back to '; z0$ 
  end
 
 
Current directory      c:\sheerpower 
Directory set to       c:\sheerpower\samples 
Directory set back to  c:\sheerpower          

DESCRIPTION:

SET SYSTEM: DIRECTORY sets the default device and directory.

11.15.6 ASK SYSTEM, LOGICAL: VALUE

FORMAT:


        ASK SYSTEM, LOGICAL str_expr: VALUE str_var 

EXAMPLE:

Example 11-26 ASK SYSTEM, LOGICAL: VALUE Statement

  ask system, logical "Sheerpower": value scr$ 
  print '"Sheerpower" points to: '; scr$ 
  end
 
 
"Sheerpower" points to: c:\SHEERPOWER\

DESCRIPTION:

ASK SYSTEM, LOGICAL asks the operating system to translate the logical name in str_expr and place the result into the variable specified by str_var.

11.15.7 SET SYSTEM, LOGICAL: VALUE

FORMAT:


        SET SYSTEM, LOGICAL str_expr1: VALUE str_expr2 

EXAMPLE:

Example 11-27 SET SYSTEM, LOGICAL: VALUE Statement

  set system, logical 'Sheerpower': value 'c:\sheerpower\examples\tester' 
  ask system, logical 'Sheerpower': value z$ 
  print 'Logical set to '; z$ 
  end
 
 
Logical set to c:\sheerpower\examples\tester 

DESCRIPTION:

SET SYSTEM, LOGICAL: VALUE statement sets the operating system logical name in str_expr1 to the value in str_expr2.

11.15.8 ASK SYSTEM: MODE

FORMAT:


        ASK SYSTEM: MODE str_var 

EXAMPLE:

Example 11-29 ASK SYSTEM: MODE Statement

  ask system: mode process_mode$ 
  print 'Process Mode: '; process_mode$ 
  end 
 
 
Process mode: BATCH 

DESCRIPTION:

ASK SYSTEM: MODE statement returns the mode of the process which is one of the following:

INTERACTIVE
BATCH
NETWORK
OTHER

11.15.9 ASK SYSTEM: PARAMETER

FORMAT:


        ASK SYSTEM: PARAMETER str_var 

EXAMPLE:

Example 11-30 ASK SYSTEM: PARAMETER Statement

// 1. Copy and paste the following four lines of code into a new program file in SPDEV. 
// 2. Name the file "test.spsrc" and save it to your /sheerpower folder 
 
  ask system: parameter param$ 
  print 'Parameter was: '; param$ 
  delay
  end
 
 
// 3. Open a Command Prompt window and type in the following at the prompt: 
 
      c:\sheerpower\test.spsrc hello  
 
// 4. The program will run and display the following in the Sheerpower console window: 
 
      Parameter was: hello                                                   


Previous Next Contents Index