Previous | Contents | Index |
Example 11-8 SET EXIT OFF Statement |
---|
line input 'Name', length 30: reply$ print _exit set exit off print _exit end Name? EXIT__________________________ 1 0 |
SET HELP ON |
Example 11-9 SET HELP ON Statement |
---|
line input 'Name', length 30: reply$ print _help set help on print _help end Name? MIKE__________________________ 0 1 |
SET HELP OFF |
Example 11-10 SET HELP OFF Statement |
---|
line input 'Name', length 30: reply$ print _help set help off print _help end Name? HELP__________________________ 1 0 |
SET ICON 'str_exp' |
Example 11-11 SET ICON Statement |
---|
// dynamically change the taskbar icon set icon "c:\sheerpower\samples\smiley.ico" print "Check out the taskbar icon... it's a smiley!" delay set icon "c:\sheerpower\samples\frowny.ico" print "and now... it's changed to a frown!" end |
SET ICON changes the icon displayed on the taskbar for each running Sheerpower application. A unique icon can be specified for every Sheerpower application. The icon can be dynamically changed during program execution.
ASK KEYSTROKES num_var |
Example 11-12 ASK KEYSTROKES Statement |
---|
input 'Please enter your name': name$ print 'Hello '; name$ ask keystrokes strokes print 'Keystrokes:'; strokes end Please enter your name? Maryanne Hello Maryanne Keystrokes: 8 |
ASK KEYSTROKES asks for the number of user-entered keystrokes.
ASK MARGIN num_var |
ASK MARGIN finds the right margin of the device specified and assigns its value to the numeric variable num_var.
SET MARGIN num_expr |
Example 11-13 SET MARGIN Statement |
---|
print repeat$('.' ,200) print ask margin old_marg input 'What do you want the margin set to': new_marg set margin new_marg print repeat$('.' ,200) set margin old_marg end .................................................. .................................................. .................................................. .................................................. What do you want the margin set to? 20 .................... .................... .................... .................... |
SET MARGIN sets the right margin on the device specified to the number indicated. num_expr specifies the column to set the margin to. The margin must be greater than zonewidth.
ASK PAGESIZE num_var |
Example 11-14 ASK PAGESIZE Statement |
---|
ask pagesize no_lines print 'There are'; no_lines; 'lines or rows on this screen' end There are 24 lines or rows on this screen |
ASK PAGESIZE returns the number of rows or lines of screen output.
SET PROGRAM TIMEOUT n |
Example 11-15 SET PROGRAM TIMEOUT Statement |
---|
set program timeout 5 for x = 1 to 100 print x delay 1 // wait one second next x end // When you run this program you will see that it never reaches 100 seconds. // Instead the it times out at 5 seconds. |
This allows you to control if the program does not end within the specified number of seconds, then end it anyway. This feature is very useful to limit the time a script from a webpage can run. For more on writing scripts in Sheerpower see Chapter 19, Sheerpower Web Scripting.
SET PROGRAM TIMEOUT is useful if you are running Sheerpower scripts and want to control the maximum time that a script can run. A typical value might be 1 (one second.)
ASK RESPONSES num_var |
Example 11-16 ASK RESPONSES Statement |
---|
input 'Please enter your name': name$ input 'What day is this': what_day$ print 'Hello '; name$ print 'Have a good '; what_day$ ask responses answers print print 'Responses:'; answers end Please enter your name? Ginger What day is this? Wednesday Hello Ginger Have a good Wednesday Responses: 2 |
ASK RESPONSES asks for the number of completed input responses.
SET SCROLL num_expr1, num_expr2 |
Example 11-17 SET SCROLL Statement |
---|
print at 21, 1: 'This text will not scroll.' set scroll 5, 20 print at 20, 1:; delay 1 print 'This' delay 1 print 'text' delay 1 print 'will' delay 1 print 'scroll.' delay 1 set scroll 1,24 end This text will scroll This text will not scroll. |
The SET SCROLL statement sets up a scrolling region from line num_expr1 to line num_expr2.
RANDOMIZE |
Example 11-18 Randomize Statement |
---|
randomize x = rnd print x end run .244013674718 run .524856061388 |
RANDOMIZE gives the RND function a new starting point. This ensures a different random number sequence each time a program executes.
Sheerpower uses a pseudo-random number sequence to generate random numbers. It uses a SEED value to start the sequence. The SEED changes each time that the RND function is used. Sheerpower used the system clock to set the initial SEED value.
RANDOMIZE tells Sheerpower to pick a random SEED value. This ensures that a different series of random numbers is returned each time the program executes. (See Section 6.1.12, RND for information on the RND function. See Section 11.14, ASK | SET SEED for the ASK/SET SEED statement.)
RANDOMIZE should only be done ONCE per the run of the program. It just uses the system clock to start the random number seed. RANDOMIZE should not be used inside of a LOOP. |
Previous | Next | Contents | Index |