| Previous | Contents | Index |
| 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 |
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.
ASK SYSTEM: RIGHTS str_var
|
Win9x does not provide any specific rights for users. ASK SYSTEM: RIGHTS will work only with Windows 2000 and Windows NT. |
| 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 |
ASK SYSTEM: RIGHTS asks the operating system to return a list of the rights explicitly granted to the calling process.
ASK SYSTEM, SYMBOL str_expr: VALUE str_var
|
| 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 |
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.
ASK SYSTEM, SYMBOL 'DNS:xxx': VALUE str_var (where 'xxxx' is a domain name or IP address to lookup) |
| 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 |
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.
SET SYSTEM, SYMBOL str_expr1: VALUE str_expr2
|
| 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 |
SET SYSTEM, SYMBOL: VALUE statement sets the operating system symbol name in str_expr1 to the value in str_expr2.
ASK SYSTEM, SYMBOL 'OS:xxx': value str$
//returns into str$ the Operating system symbol value of 'xxx'
|
| 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\ |
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.
ASK SYSTEM: USER str_var
|
| Example 11-37 ASK SYSTEM: USER statement |
|---|
ask system : user uname$ print 'User is: '; uname$ end User is: Default |
ASK SYSTEM: USER statement returns the operating system name or ID for the user.
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.
ASK WINDOW AREA row, col, row, col: DATA str_var
|
| 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
|
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.
SET WINDOW AREA row, col, row, col: DATA str_expr
|
| 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
|
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.
ASK WINDOW: COLUMN num_var
|
| 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 |
ASK WINDOW: COLUMN statement returns the current column of the cursor's position.
SET WINDOW: COLUMN num_expr
|
| Example 11-41 SET WINDOW: COLUMN statement |
|---|
print at 5,10:;
set window: column 4
print 'Hi!'
end
Hi!
|
SET WINDOW: COLUMN statement positions the cursor at the num_expr column within the current row.
ASK WINDOW: CURRENT str_var
SET WINDOW: CURRENT str_var
|
| Previous | Next | Contents | Index |