Sheerpower®
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. You can pass up to 8 parameters.

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.15.10 ASK SYSTEM: PID

FORMAT:


        ASK SYSTEM: PID str_var 

EXAMPLE:

Example 11-31 ASK SYSTEM: PID Statement

  ask system: pid current_pid$ 
  print 'Current Process ID is: '; current_pid$ 
  end
 
 
 
Current Process ID is: 8936                                     

PURPOSE:

ASK SYSTEM: PID returns into str_var the PROCESS ID of the current process.

DESCRIPTION:

The process id, PID, is often written to log files or audit tables when tracking information about a given Sheerpower process.

11.15.11 ASK SYSTEM: PROCESS

FORMAT:


        ASK SYSTEM: PROCESS str_var 

EXAMPLE:

Example 11-32 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.15.12 SET SYSTEM: PROCESS

FORMAT:


        SET SYSTEM: PROCESS str_expr 

EXAMPLE:

Example 11-33 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.15.13 ASK SYSTEM: PROGRAM

FORMAT:


        ASK SYSTEM: PROGRAM str_var 

EXAMPLE:

Example 11-34 ASK SYSTEM: PROGRAM Statement

  // make a sample program file called 
  // mysample.spsrc in \sheerpower\samples\
  // 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 using the %compile directive (see Section 3.9, Program and Compile Directives).

11.15.14 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-35 ASK SYSTEM: RIGHTS statement

  ask system: rights process_rights$ 
  print 'Your process rights are: '; process_rights$ 
  end
 
 
Your process rights are: SeLockMemoryPrivilege,SeIncreaseQuotaPrivilege,SeSecuri 
tyPrivilege,SeTakeOwnershipPrivilege,SeLoadDriverPrivilege,SeSystemProfilePrivil 
ege,SeSystemtimePrivilege,SeProfileSingleProcessPrivilege,SeIncreaseBasePriority 
Privilege,SeCreatePagefilePrivilege,SeBackupPrivilege,SeRestorePrivilege,SeShutd 
ownPrivilege,SeDebugPrivilege,SeSystemEnvironmentPrivilege,SeChangeNotifyPrivile 
ge,SeRemoteShutdownPrivilege,SeUndockPrivilege,SeManageVolumePrivilege,SeImperso 
natePrivilege,SeCreateGlobalPrivilege,SeIncreaseWorkingSetPrivilege,SeTimeZonePr 
ivilege,SeCreateSymbolicLinkPrivilege 

DESCRIPTION:

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

11.15.15 ASK SYSTEM, SYMBOL: VALUE

FORMAT:


        ASK SYSTEM, SYMBOL str_expr: VALUE str_var 

EXAMPLE:

Example 11-36 ASK SYSTEM, SYMBOL: VALUE statement

  set system, symbol 'Sheerpower': value 'Sheerpower Rapid Development Environment' 
  ask system, symbol 'Sheerpower': value symbol$ 
  print 'Value of symbol Sheerpower is: '; symbol$ 
  end
 
 
Value of symbol Sheerpower is: Sheerpower Rapid Development Environment 

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.15.16 Performing DNS Lookups with ASK SYSTEM, SYMBOL

FORMAT:


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

EXAMPLE:

Example 11-37 DNS Lookups Using ASK SYSTEM, SYMBOL

  ask system, symbol 'dns:cnn.com': value x$ 
  print x$ 
  
  
151.101.129.67 

Example 11-38 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:x.x.x.x': VALUE a$ returns into a$ the IP address associated with x.x.x.x. If the DNS lookup fails, a$ will be a null string.

11.15.17 SET SYSTEM, SYMBOL: VALUE

FORMAT:


        SET SYSTEM, SYMBOL str_expr1: VALUE str_expr2 

EXAMPLE:

Example 11-39 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:

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

11.15.18 ASK/SET SYSTEM, SYMBOL 'DNS:x.x.x.x' Prefix

FORMAT:


        ASK SYSTEM, SYMBOL 'DNS:x.x.x.x': value str$ 
        //returns into str$ the DNS translation of 'x.x.x.x' 

EXAMPLES:

Example 11-40 ASK SYSTEM, SYMBOL 'DNS:x.x.x.x': VALUE Statement

 
  ask system,symbol 'dns:0.0.0.0': value x$ 
  print 'Your computer name is: '; x$  
  end
 
 
Your computer name is: TTI-DEV* 

Example 11-41 ASK SYSTEM, SYMBOL 'DNS:x.x.x.x': VALUE Statement

 
  ask system,symbol 'dns:www.cnn.com': value x$ 
  print 'The IP address is: '; x$  
  end
 
 
The IP address is: 157.166.238.48 

DESCRIPTION:

The DNS: prefix to a symbol returns the DNS translation value of "x.x.x.x". The value of "x.x.x.x" can be an IP address or a URL. It is useful in checking a server's internet connection or a website's availability.

11.15.19 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' 


Previous Next Contents Index