SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

PURPOSE:

ASK SYSTEM: PARAMETER returns any parameter from the command line given after the program name and places it in str_var.

DESCRIPTION:

ASK SYSTEM: PARAMETER lets you obtain the command line that invoked SheerPower. The statement gives you the part of the command line after the program name.

11.14.9 ASK SYSTEM: PROCESS

FORMAT:


        ASK SYSTEM: PROCESS str_var 

EXAMPLE:

Example 11-28 ASK SYSTEM: PROCESS statement

  ask system: process process$ 
  print 'Process is: '; process$ 
  end
 
 
Process is: SheerPower 4GL 

DESCRIPTION:

ASK SYSTEM: PROCESS str_var asks the operating system for the current process name.

11.14.10 SET SYSTEM: PROCESS

FORMAT:


        SET SYSTEM: PROCESS str_expr 

EXAMPLE:

Example 11-29 SET SYSTEM: PROCESS statement

  ask system: process process$ 
  curr_process$ = process$ 
  print 'Current process is: '; curr_process$ 
  new_process$ = 'do_test' 
  set system: process new_process$ 
  ask system: process process$ 
  print 'New process is: '; process$ 
  set system: process curr_process$ 
  ask system: process process$ 
  print 'Old process restored: '; process$ 
  end
 
 
Current process is: SheerPower 4GL 
New process is: DO_TEST 
Old process restored: SheerPower 4GL 

DESCRIPTION:

SET SYSTEM: PROCESS str_expr changes the operating system process name to str_expr.

11.14.11 ASK SYSTEM: PROGRAM

FORMAT:


        ASK SYSTEM: PROGRAM str_var 

EXAMPLE:

Example 11-30 ASK SYSTEM: PROGRAM Statement

  // make a sample program file called 
  // mysample.spsrc in the SheerPower Samples folder 
  // and paste in the following code: 
  
  ask system: program x$ 
  print 'This program is '; x$ 
  end
 
 
This program is c:\sheerpower\samples\mysample.spsrc 

DESCRIPTION:

The ASK SYSTEM: PROGRAM statement returns the full file specification of the running program. This is helpful for programs that check their own revision dates and for .SPRUN files that want to scan for compiled in licenses.

11.14.12 ASK SYSTEM: RIGHTS

FORMAT:


        ASK SYSTEM: RIGHTS str_var 

Important note on the following example:

Win9x does not provide any specific rights for users. ASK SYSTEM: RIGHTS will work only with Windows 2000 and Windows NT.

EXAMPLE:

Example 11-31 ASK SYSTEM: RIGHTS statement

  ask system: rights process_rights$ 
  print 'Your process rights are: '; process_rights$ 
  end
 
 
Your process rights are: FAST_ACCESS,TEST_ACCESS 

DESCRIPTION:

ASK SYSTEM: RIGHTS asks the operating system to return a list of the rights explicitly granted to the calling process.

11.14.13 ASK SYSTEM, SYMBOL: VALUE

FORMAT:


        ASK SYSTEM, SYMBOL str_expr: VALUE str_var 

EXAMPLE:

Example 11-32 ASK SYSTEM, SYMBOL: VALUE statement

  set system, symbol 'SheerPower': value 'SheerPower 4GL' 
  ask system, symbol 'SheerPower': value symbol$ 
  print 'Value of symbol SheerPower is: '; symbol$ 
  end
 
 
Value of symbol SheerPower is: SheerPower 4GL 

DESCRIPTION:

ASK SYSTEM, SYMBOL: VALUE statement asks the operating system to translate the symbol name in str_expr and place the result into the variable specified by str_var.

11.14.14 Performing DNS Lookups with ASK SYSTEM, SYMBOL

FORMAT:


  ASK SYSTEM, SYMBOL 'DNS:xxx': VALUE str_var 
  
  (where 'xxxx' is a domain name or IP address to lookup) 

EXAMPLE:

Example 11-33 DNS Lookups using ASK SYSTEM, SYMBOL

  ask system, symbol 'dns:mail.ttinet.com': value x$ 
  print x$ 
  
  
38.112.130.3 

Example 11-34 DNS Lookup that does not exist

  ask system, symbol 'dns:mymail.ttinet.com': value x$ 
  print x$  // it returns a blank since mymail.ttinet.com does not exist 
  
  

DESCRIPTION:

ASK SYSTEM, SYMBOL 'DNS:xxx': VALUE a$ returns into a$ the IP address associated with xxx. If the DNS lookup fails, a$ will be a null string.

11.14.15 SET SYSTEM, SYMBOL: VALUE

FORMAT:


        SET SYSTEM, SYMBOL str_expr1: VALUE str_expr2 

EXAMPLE:

Example 11-35 SET SYSTEM, SYMBOL: VALUE statement

  set system, symbol 'mysym': value 'hello' 
  ask system, symbol 'mysym': value z$ 
  print 'Symbol set to '; z$ 
  end
 
 
Symbol set to hello 
For an example on how to read and write to the Windows registry using SET SYSTEM, SYMBOL: VALUE and ASK SYSTEM, SYMBOL: VALUE, see Section 12.1, Read/Write to the Windows Registry.

DESCRIPTION:

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

11.14.16 ASK SYSTEM: USER

FORMAT:


        ASK SYSTEM: USER str_var 

EXAMPLE:

Example 11-36 ASK SYSTEM: USER statement

  ask system : user uname$ 
  print 'User is: '; uname$ 
  end
 
 
User is: Default 

PURPOSE:

ASK SYSTEM: USER statement returns the operating system name or ID for the user.

11.15 ASK | SET WINDOW

There are various ASK WINDOW and SET WINDOW statements. These are described in the following sections. The ASK/SET WINDOW statements ask about and reset different screen features.

11.15.1 ASK WINDOW AREA

FORMAT:


        ASK WINDOW AREA row, col, row, col: DATA str_var 

EXAMPLE:

Example 11-37 ASK WINDOW AREA statement

  print at 10, 4: 'Mary had a'; 
  print at 11, 4: 'little lamb'; 
  ask window area 10, 4, 11, 15: data x$ 
  print
  print x$ 
  end
 
 
   Mary had a 
   little lamb 
Mary had a 
          little lamb 

DESCRIPTION:

ASK WINDOW AREA statement reads the text displayed on the screen within the area defined by the given upperleft/lowerright coordinates into a string variable, str_var. The coordinates are specified by upper-left row, upper-left column, lower-right row, lower-right column. The statement returns a <LF> delimited string. No screen attributes are stored.

11.15.2 SET WINDOW AREA

FORMAT:


        SET WINDOW AREA row, col, row, col: DATA str_expr 

EXAMPLE:

Example 11-38 SET WINDOW AREA statement

  x$ = 'Mary had a' + chr$(10) + 'little lamb' 
  set window area 6, 5, 7, 15: data x$ 
  end
 
 
 
    Mary had a 
    little lamb 

DESCRIPTION:

SET WINDOW AREA statement sets the screen within the area defined by the given upperleft/lowerright coordinates to the specified string. This is the mirror image of ASK WINDOW AREA row, col, row, col: DATA str_var.

11.15.3 ASK WINDOW: COLUMN

FORMAT:


        ASK WINDOW: COLUMN num_var 


Previous Next Contents Index