SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

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/SET SYSTEM, SYMBOL 'OS:xxx' Prefix

FORMAT:


        ASK SYSTEM, SYMBOL 'OS:xxx': value str$ 
        //returns into str$ the Operating system symbol value of 'xxx' 

EXAMPLE:

Example 11-36 ASK SYSTEM, SYMBOL 'OS:xxx': VALUE statement

 
  ask system, symbol 'os:path': value mypath$ 
  print 'The path value is: '; mypath$ 
  end
 
 
The path value is: c:\windows;c:\windows\system32;C:\SheerPower\

DESCRIPTION:

The os: prefix to a symbol says that we are referencing the OPERATING SYSTEM SYMBOL. In the case of WINDOWS, this is the COMMAND window symbol.

11.14.17 ASK SYSTEM: USER

FORMAT:


        ASK SYSTEM: USER str_var 

EXAMPLE:

Example 11-37 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-38 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-39 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 

EXAMPLE:

Example 11-40 ASK WINDOW: COLUMN statement

  print at 5,10:; 
  ask window: column cur_col 
  print 'Cursor is at column'; cur_col 
  end
 
 
Cursor is at column 10 

DESCRIPTION:

ASK WINDOW: COLUMN statement returns the current column of the cursor's position.

11.15.4 SET WINDOW: COLUMN

FORMAT:


        SET WINDOW: COLUMN num_expr 

EXAMPLE:

Example 11-41 SET WINDOW: COLUMN statement

  print at 5,10:; 
  set window: column 4 
  print 'Hi!' 
  end
 
 
    Hi! 

DESCRIPTION:

SET WINDOW: COLUMN statement positions the cursor at the num_expr column within the current row.

11.15.5 ASK | SET WINDOW: CURRENT

FORMAT:


        ASK WINDOW: CURRENT str_var 
        SET WINDOW: CURRENT str_var 


Previous Next Contents Index