Mnemonics "S"

From CometWiki

Revision as of 03:52, 24 February 2012 by Brian (Talk | contribs)
Jump to: navigation, search

Contents

(SatisfyInput)

Mnemonic:  (SatisfyInput=data$)  
Discussion:  Typically, your program will be positioned at an INPUT statement when the user clicks on a hyperlink. When the event handling subroutine concludes, it returns to the same INPUT statement (assuming that you've concluded the subroutine with a RETURN statement). 
The (SatisfyInput) mnemonic provides a way for the event handling subroutine to supply input data to the original INPUT statement. Here's an outline of the process: 


display a Comet hyperlink 
set an eventsub trap 
go to the main processing section of your program, which includes an INPUT statement 
in the eventsub routine, use the (SatisfyInput) mnemonic to assign input data that will be fed to the INPUT statement when someone clicks on a hyperlink 
Thus, when the user clicks on the hyperlink, the program will branch to the event handing subroutine, where it will provide the input data to the original data entry field. This is a perfect solution 
 
Example:  Print @(40,3);"Run your favorite utility program"
Print @(40,4);(Hyperlink="Spooler","LINK7",1)
Print @(40,5);(Hyperlink="Comet Editor","LINK8",1)
Print @(40,6);(Hyperlink="Utility menu","LINK9",1)

! set EVENTSUB trap

EVENTSUB GetEvent,Event$,Source$

! MainLineProcessing
	Input @(34,20),Program$

ProgEnd:
	if (Program$ EQ "") Then_
		Program$ = "QMONITOR"

	Print (WC);(BF)
	Run Program$

! = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
!
!   E V E N T   P R O C E S S I N G   S U B R O U T I N E
!
! = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

GetEvent:

	Print (WC);(BF)

	! make processing decisions based on the value of the EventString$

	Select Case Event$
	.
	.
	.
		Case "LINK7"
			TempProg$ = "QSPOOL"

		Case "LINK8"
			TempProg$ = "CED"

		Case "LINK9"
			TempProg$ = "QTILITY"
	.
	.
	.
	Endselect

! Pass result back to main-line program and exit input
	If (TempProg$ NE "")
		Print (SatisfyInput = TempProg$)
	EndIf

	! re-set Eventsub trap
EVENTSUB GetEvent,Event$,Source$

RETURN

(Save Screen)

 
Mnemonic:   (Save Screen)  
Hex equivalent:  "@040003@"  
Discussion:  This mnemonic saves the current screen display, including all text and display attributes, variables, screen colors, the screen mode, and the memory and display contents of all Comet windows that are open. This mnemonic also frees up all windows memory for the console session. 
This information is saved in a data file named "SCRN" + TERM$. This file is created automatically by Comet and placed on the first local RAM disk found among the accessed Comet directories; if no local RAM disk is found, Comet uses the current DOS directory. (This is the same directory where the partition environments are saved when ENTER statements are executed.) 

Note: This file is a DOS file, not a Comet file (i.e., there is no automatic entry in the QDIR file for this file). 

The console screen display does not change when this control is written. Your application may proceed to write new information to the screen, use windows memory blocks, etc. 

To restore the screen display, use (Restore Screen). 
 
Example:  a. 100 FORMAT (Save Screen)
   .
   PRINT (0,100

b. PRINT (0) (Save Screen)

(SB)

 
Mnemonic:   (SB)  
Hex equivalent:  "08@"  
Discussion:  Start background display. 
The (SB) control code sets background display mode and causes subsequent characters to be displayed as background (inverse video) characters. This is used for displaying data that is not expected to change, such as prompts and headings. 

Characteristics of background mode: 

Background fields are for display purposes only. Data cannot be input from a background field. 

Characters appear in the configured background color. 

The cursor cannot be positioned in a background field from the keyboard. An attempt to position the cursor in a background field with a FORMAT statement will cause the cursor to be positioned in the next available foreground field. 

Background mode must be set in each FORMAT statement where it is to be used. Unless set to background mode, the video device will display data in foreground mode. 

Foreground and background can be mixed in one FORMAT statement, as long as the appropriate control codes (i.e., (SF) and (SB)) are used to start each operation. 
 
Example:  a. 100 FORMAT (SB);(BF),@(10,0)
   .
   PRINT (0,100)

b. PRINT (0) (SB);(BF),@(10,0)

This example sets the video mode to background (SB), and blank fills the top row of the screen (i.e., row 0) from position 10 to the end of the line.  

(Scan Codes Off)

 
Mnemonic:   (Scan Codes Off)  
Hex equivalent:  "@0E000F@"  
Discussion:  This mnemonic turns off the "scan code mode." For more information, see (Full Scan Codes Passed).  
Example:  a. 100 FORMAT (Scan Codes Off)
   .
   PRINT (0,100)

b. PRINT (0) (Scan Codes Off)

(Screen)

 
Mnemonic:   (Screen=number-of-columns, number-of-rows)  
Discussion:  The (Screen) mnemonic sets the size of the COSW screen. Number-of-columns and number-of-rows are numeric values between 1 and 254. 
If you are running Comet maximized, and the virtual screen size is larger than the physical screen size, Comet automatically reduces the font size so the entire display fits on the screen. Note: This can result in very small type (e.g., if the column and row values are set to high values). 

If you are running Comet non-maximized, and the virtual screen size is larger than the physical screen size, Comet automatically inserts scroll bars (horizontal and/or vertical) on the screen. 

For a demonstration of the (Screen) mnemonic, run the CPLANY program in the DMW directory (the 98.11 version). 

Also see (CPL132), (CPL64), and (CPL80). 
 
History:  This mnemonic was added in the REL release 99.01.  
Example:  ! set screen size to 100 columns x 50 rows

Print (Screen=100,50)

(SelectFont

) 
Mnemonic:   (SelectFont);log-font-data  
Discussion:  Selects the font specified by the log-font-data structure. 
Typically, a user will call GDI.InitLogFont first to set all font fields to their default values, and then modify whichever field needs changing. 

Because the font structure consists of Internet Basic strings, the INTEL/INTELD functions must be used to effect any modifications. For an example see the GDI.InitLogFont function in the usefile #LOGFNT. 

Some commonly modified fields are: 

lfHeight$  Font size in 10th's of a point (inch/72). The font mapper looks for the largest font that does not exceed the requested size; if there is no such font, it looks for the smallest font available.  
lfWidth$  Specifies the average width, in logical units, of characters in the font. If lfWidth is zero, the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts to find the closest match, determined by the absolute value of the difference.  
lfEscapement$  Specifies the angle, in tenths of degrees, of each line of text written in the font (relative to the bottom of the page).  
lfOrientation$  Specifies the angle, in tenths of degrees, of each character's base line (relative to the bottom of the page).  
lfWeight$  Darkness (or lightness) of the characters  
lfItalic$  Specifies an italic font if set to TRUE.  
lfUnderline$  Specifies an underlined font if set to TRUE.  
lfStrikeOut$  Specifies a strikeout font if set to TRUE.  
lfFaceName$  Desired font face ("Arial", "Courier New", etc.)  

 
History:  This mnemonic is valid in Comet98 and greater.  

(SelectHatchBrush)

 
Mnemonic:   (SelectHatchBrush = style, red, green, blue)  
Discussion:  This mnemonic selects the hatched brush described style and red, green, blue. 
Where style can be one of the following values: 

HS.HORIZONTAL   Horizontal hatch

HS.VERTICAL     Vertical hatch

HS.FDIAGONAL    Upward hatch (left to right) at 45 degrees

HS.BDIAGONAL    Downward hatch (left to right) at 45 degrees

HS.CROSS        Horizontal and vertical crosshatch

HS.DIAGCROSS    Crosshatch at 45 degrees

Note: See SetTextColor for color parameter information. 
 
History:  This mnemonic is valid in Comet98 and greater.  

(SelectPen)

 
Mnemonic:   (SelectPen = style, width, red, green, blue)  
Discussion:  This mnemonic selects the pen described by style, width and red, green, blue. 
Available pen styles are: 

PS.SOLID  Creates a solid pen.  
PS.DASH  Creates a dashed pen. Valid only when the pen width is 1 or less, in device units.  
PS.DOT  Creates a dotted pen. Valid only when the pen width is 1 or less, in device units.  
PS.DASHDOT  Creates a pen with alternating dashes and dots. Valid only when the pen width is 1 or less, in device units.  
PS.DASHDOTDOT  Creates a pen with alternating dashes and double dots. Valid only when the pen width is 1 or less, in device units.  
PS.NULL  Creates a null pen.  
PS.INSIDEFRAME  Creates a pen that draws a line inside the frame of closed shapes produced by the Windows GDI output functions that specify a bounding rectangle (for example, the Ellipse, Rectangle, RoundRect, Pie, and Chord member functions). When this style is used with Windows GDI output functions that do not specify a bounding rectangle (for example, the LineTo member function), the drawing area of the pen is not limited by a frame. 
If the width of the pen PtrWidth is 0, the width in device units is always 1 pixel, regardless of the mapping mode. 
 


Note: See (SetTextColor) for color parameter information. 
 
History:  This mnemonic is valid in Comet98 and greater.  

(SelectSolidBrush)

 
Mnemonic:   (SelectSolidBrush = red, green, blue)  
Discussion:  This mnemonic selects the solid brush described red, green, blue. 
Note: See (SetTextColor) for color parameter information. 
 
History:  This mnemonic is valid in Comet98 and greater.  

(SelectSysFont)

 
Mnemonic:   (SelectSysFont = font-number)  
Discussion:  Selects the SYSTEM font specified by font-number. 
Where: 

font-number = a Number from 0 to 2, corresponding to an entry in the COSW.INI [Printer Fonts] section. 

Provides a system dependent method for assuring compatible printer output by allowing the system user to choose the system fonts according to what is available at that system. 

Font numbers are defined as follows: 

0 is used for normal printing
1 is used for compact (compressed) printing
2 is used for wide (expanded) printing 
 
History:  This mnemonic is valid in Comet98 and greater 

(SelectWindowEx)

 
Mnemonic:   (SelectWindowEx=handle$,flags)  
Discussion:  This mnemonic selects an extended window, using the following parameters: 
Parameter Description 
handle$ This 4-byte string value is the handle that was assigned to this window when it was created. 
flags This numeric value determines whether the selected window is activated or not: 
Value Meaning 
0 The window is not activated. 
1 This window is activated. 

 


Each extended window is identified by a 4-byte string known as a window handle. The handle value is assigned by the system and returned to the Internet Basic program via an INPUT statement following the (CreateWindowEx). 

An extended window is deleted via (DeleteWindowEx) mnemonic. 

See the WinDemo.ibs program (available at www.signature.net/download/demos) for examples of extended windows. 
 
Note:  If you write a program that displays more than one extended window at a time, your program may need some way to distinguish which window was active at the time that data was input. The STS function returns the handle of the window that generated the input. This 4-byte value starts in position 11, as shown here: 
Length 4 & Local Handle$
.
Handle$ = SUB(STS(0),11,4)

 
History:  This feature is supported in Comet2002 Build 306 and higher.  
Example:  The following example creates two extended windows, then uses the (SelectWindowEx) mnemonic to select between the two. 
Length 4 & Local Handle1$,Handle2$
.
Print (CreateWindowEx=0,0,35,15,68,0,"Window 1")
Input Handle1$

Print (CreateWindowEx=0,40,20,10,68,0,"Window 2")
Input Handle2$
.
Print (SelectWindowEx=Handle1$,1)  ! select window 1
Print "This text goes in window 1"
.
Print (SelectWindowEx=Handle2$,1)  ! select window 2
Print "This text goes in window 2"

(Server)

 
Email Mnemonic:   (Server=string-argument)  
Discussion:  The (Server) mnemonic specifies the smtp server and port to be used for your email printer. Get this information from the settings for your email client program. The default port is 25 (AKA "mail"). If you do not specify a port, the default will be used. 
Please note that servers requiring authentication are not supported at this time. 
 
Example:  OPEN (1) "LEH"
PRINT (1) (Server="smtp.our.mail.server.net 25")

 
 Read about other Email Mnemonics  

(SessionTimeout)

(Set Printer Info)

 
Mnemonic:   (SetPrinterInfo = FunctionCode, Value) 
where FunctionCode is the characteristic you want to change, and Value is the value you want to change it to 
 
Discussion:  The following FunctionCodes and Values are also contained in the file #PTRCTLD in the WDL folder. 
PI.DMORIENTATION = 0
    DMORIENT.PORTRAIT = 1
    DMORIENT.LANDSCAPE = 2

PI.DMPAPERSIZE = 1
    DMPAPER.LETTER               = 1  ! Letter 8 1/2 x 11 in
    DMPAPER.LETTERSMALL          = 2  ! Letter Small 8 1/2 x 11 in
    DMPAPER.TABLOID              = 3  ! Tabloid 11 x 17 in
    DMPAPER.LEDGER               = 4  ! Ledger 17 x 11 in
    DMPAPER.LEGAL                = 5  ! Legal 8 1/2 x 14 in
    DMPAPER.STATEMENT            = 6  ! Statement 5 1/2 x 8 1/2 in
    DMPAPER.EXECUTIVE            = 7  ! Executive 7 1/4 x 10 1/2 in
    DMPAPER.A3                   = 8  ! A3 297 x 420 mm
    DMPAPER.A4                   = 9  ! A4 210 x 297 mm
    DMPAPER.A4SMALL             = 10  ! A4 Small 210 x 297 mm
    DMPAPER.A5                  = 11  ! A5 148 x 210 mm
    DMPAPER.B4                  = 12  ! B4 (JIS) 250 x 354
    DMPAPER.B5                  = 13  ! B5 (JIS) 182 x 257 mm
    DMPAPER.FOLIO               = 14  ! Folio 8 1/2 x 13 in
    DMPAPER.QUARTO              = 15  ! Quarto 215 x 275 mm
    DMPAPER.10X14               = 16  ! 10x14 in
    DMPAPER.11X17               = 17  ! 11x17 in
    DMPAPER.NOTE                = 18  ! Note 8 1/2 x 11 in
    DMPAPER.ENV.9               = 19  ! Envelope #9 3 7/8 x 8 7/8
    DMPAPER.ENV.10              = 20  ! Envelope #10 4 1/8 x 9 1/2
    DMPAPER.ENV.11              = 21  ! Envelope #11 4 1/2 x 10 3/8
    DMPAPER.ENV.12              = 22  ! Envelope #12 4 \276 x 11
    DMPAPER.ENV.14              = 23  ! Envelope #14 5 x 11 1/2
    DMPAPER.CSHEET              = 24  ! C size sheet
    DMPAPER.DSHEET              = 25  ! D size sheet
    DMPAPER.ESHEET              = 26  ! E size sheet
    DMPAPER.ENV.DL              = 27  ! Envelope DL 110 x 220mm
    DMPAPER.ENV.C5              = 28  ! Envelope C5 162 x 229 mm
    DMPAPER.ENV.C3              = 29  ! Envelope C3  324 x 458 mm
    DMPAPER.ENV.C4              = 30  ! Envelope C4  229 x 324 mm
    DMPAPER.ENV.C6              = 31  ! Envelope C6  114 x 162 mm
    DMPAPER.ENV.C65             = 32  ! Envelope C65 114 x 229 mm
    DMPAPER.ENV.B4              = 33  ! Envelope B4  250 x 353 mm
    DMPAPER.ENV.B5              = 34  ! Envelope B5  176 x 250 mm
    DMPAPER.ENV.B6              = 35  ! Envelope B6  176 x 125 mm
    DMPAPER.ENV.ITALY           = 36  ! Envelope 110 x 230 mm
    DMPAPER.ENV.MONARCH         = 37  ! Envelope Monarch 3.875 x 7.5 in
    DMPAPER.ENV.PERSONAL        = 38  ! 6 3/4 Envelope 3 5/8 x 6 1/2 in
    DMPAPER.FANFOLD.US          = 39  ! US Std Fanfold 14 7/8 x 11 in
    DMPAPER.FANFOLD.STD.GERMAN  = 40  ! German Std Fanfold 8 1/2 x 12 in
    DMPAPER.FANFOLD.LGL.GERMAN  = 41  ! German Legal Fanfold 8 1/2 x 13 in
    DMPAPER.ISO.B4              = 42  ! B4 (ISO) 250 x 353 mm
    DMPAPER.JAPANESE.POSTCARD   = 43  ! Japanese Postcard 100 x 148 mm
    DMPAPER.9X11                = 44  ! 9 x 11 in
    DMPAPER.10X11               = 45  ! 10 x 11 in
    DMPAPER.15X11               = 46  ! 15 x 11 in
    DMPAPER.ENV.INVITE          = 47  ! Envelope Invite 220 x 220 mm
    DMPAPER.RESERVED.48         = 48  ! RESERVED--DO NOT USE
    DMPAPER.RESERVED.49         = 49  ! RESERVED--DO NOT USE
    DMPAPER.LETTER.EXTRA        = 50  ! Letter Extra 9 \275 x 12 in
    DMPAPER.LEGAL.EXTRA         = 51  ! Legal Extra 9 \275 x 15 in
    DMPAPER.TABLOID.EXTRA       = 52  ! Tabloid Extra 11.69 x 18 in
    DMPAPER.A4.EXTRA            = 53  ! A4 Extra 9.27 x 12.69 in
    DMPAPER.LETTER.TRANSVERSE   = 54  ! Letter Transverse 8 \275 x 11 in
    DMPAPER.A4.TRANSVERSE       = 55  ! A4 Transverse 210 x 297 mm
    DMPAPER.LETTER.EXTRA.TRANSVERSE = 56 ! Letter Extra Transverse 9\275 x 12 in
    DMPAPER.A.PLUS              = 57  ! SuperA/SuperA/A4 227 x 356 mm
    DMPAPER.B.PLUS              = 58  ! SuperB/SuperB/A3 305 x 487 mm
    DMPAPER.LETTER.PLUS         = 59  ! Letter Plus 8.5 x 12.69 in
    DMPAPER.A4.PLUS             = 60  ! A4 Plus 210 x 330 mm
    DMPAPER.A5.TRANSVERSE       = 61  ! A5 Transverse 148 x 210 mm
    DMPAPER.B5.TRANSVERSE       = 62  ! B5 (JIS) Transverse 182 x 257 mm
    DMPAPER.A3.EXTRA            = 63  ! A3 Extra 322 x 445 mm
    DMPAPER.A5.EXTRA            = 64  ! A5 Extra 174 x 235 mm
    DMPAPER.B5.EXTRA            = 65  ! B5 (ISO) Extra 201 x 276 mm
    DMPAPER.A2                  = 66  ! A2 420 x 594 mm
    DMPAPER.A3.TRANSVERSE       = 67  ! A3 Transverse 297 x 420 mm
    DMPAPER.A3.EXTRA.TRANSVERSE = 68  ! A3 Extra Transverse 322 x 445 mm

PI.DMPAPERLENGTH = 2
PI.DMPAPERWIDTH = 3
PI.DMSCALE = 4
PI.DMPRINTQUALITY = 5
    DMRES.DRAFT     = 65535 ! -1
    DMRES.LOW       = 65534 ! -2
    DMRES.MEDIUM    = 65533 ! -3
    DMRES.HIGH      = 65532 ! -4

PI.DMCOLOR = 6
    DMCOLOR.MONOCHROME = 1
    DMCOLOR.COLOR    = 2

PI.DMCOLLATE = 7
    DMCOLLATE.FALSE = 0
    DMCOLLATE.TRUE = 1

PI.DMDEFAULTSOURCE = 8
    DMBIN.UPPER         = 1
    DMBIN.ONLYONE       = 1
    DMBIN.LOWER         = 2
    DMBIN.MIDDLE        = 3
    DMBIN.MANUAL        = 4
    DMBIN.ENVELOPE      = 5
    DMBIN.ENVMANUAL     = 6
    DMBIN.AUTO          = 7
    DMBIN.TRACTOR       = 8
    DMBIN.SMALLFMT      = 9
    DMBIN.LARGEFMT      = 10
    DMBIN.LARGECAPACITY = 11
    DMBIN.CASSETTE      = 14
    DMBIN.FORMSOURCE    = 15

(Set ROP2)

Mnemonic:  (SetROP2 = Mode)  
Discussion:  Sets the current foreground mix mode. GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined. 
Where Mode can be any of the following values: 

Mix mode Description 
R2.BLACK = 1 Pixel is always 0. 
R2.COPYPEN = 13 Pixel is the pen color. 
R2.MASKNOTPEN = 3 Pixel is a combination of the colors common to both the screen and the inverse of the pen. 
R2.MASKPEN = 9 Pixel is a combination of the colors common to both the pen and the screen. 
R2.MASKPENNOT = 5 Pixel is a combination of the colors common to both the pen and the inverse of the screen. 
R2.MERGENOTPEN = 12 Pixel is a combination of the screen color and the inverse of the pen color. 
R2.MERGEPEN = 15 Pixel is a combination of the pen color and the screen color. 
R2.MERGEPENNOT = 14 Pixel is a combination of the pen color and the inverse of the screen color. 
R2.NOP = 11 Pixel remains unchanged. 
R2.NOT = 6 Pixel is the inverse of the screen color. 
R2.NOTCOPYPEN = 4 Pixel is the inverse of the pen color. 
R2.NOTMASKPEN = 8 Pixel is the inverse of the R2_MASKPEN color. 
R2.NOTMERGEPEN = 2 Pixel is the inverse of the R2_MERGEPEN color. 
R2.NOTXORPEN = 10 Pixel is the inverse of the R2_XORPEN color. 
R2.WHITE = 16 Pixel is always 1. 
R2.XORPEN = 7 Pixel is a combination of the colors in the pen and in the screen, but not in both. 

(Set Window Caption)

 
Mnemonic:  (Set Window Caption=caption$,flag)  
Discussion:  This mnemonic sets the window caption. 
The flag parameter may contain the following values: 

0 = Show specified caption as is (Main view or selected window)
1 = Include standard caption (Comet TXX) with specified caption (Main view only)
2 = Use default specified in COSW.INI ([Comet] IncludeStdCaption) (Main view only) 
 
History:  This mnemonic was added in REL Version 02.04.  
Example:  Print (Set Window Caption = "This is the caption",0)

(SetBkColor)

 
Mnemonic:   (SetBkColor = red, green, blue)  
Discussion:  Sets the current background color as specified by red, green, and blue. 
Colors are represented by three (red, green, glue) color intensity values, each ranging in value from 0 (no color = black) to 255 (max color = white). 

red specifies the amount of RED
green specifies the amount of GREEN
blue specifies the amount of BLUE 
 
History:  This mnemonic is valid in Comet98 and greater.  

(SetBkMode)

 
Mnemonic:   (SetBkMode = mode)  
Discussion:  Sets the background mode specified by mode. 
Sets the background mode. The background mode defines whether the system removes existing background colors on the drawing surface before drawing text, hatched brushes, or any pen style that is not a solid line. 

Where mode is: 

BKM.OPAQUE  Background is filled with the current background color before the text, hatched brush, or pen is drawn. This is the default background mode.  
BKM.TRANSPARENT  Background is not changed before drawing.  

 
History:  This mnemonic is valid in Comet98 and greater.  

(SetDirAlias)

 
Mnemonic:  (SetDirAlias=alias,path,flags)  
Discussion:  This mnemonic sets the name/path of a directory alias. 
This mnemonic may be used by foreground programs only. 

The alias is the "alias identifier" as specified in COSW (e.g., CATEMP). 

The path is a Windows or UNC path name. 

Flags is the sum of the specified decimal values from the following chart: 

Flag Description 
1 Perform function at CometAnywhere remote system 
2 If not CometAnywhere, then substitute local for remote 
If the program is running on a local Comet system (not on a CometAnywhere client system), this flag substitutes the local drive/path name for a remote path/drive name.
 


After this mnemonic is issued, your program can issue an INPUT on LUN (0) to retrieve the error information. For example: 

  LENGTH 2 & LOCAL AX$,DX$
  LENGTH 254 & LOCAL RESULT$
  ResultFmt: FORMAT AX$;DX$;RESULT$
  .
  .
  Print (SetDirAlias=Alias$,Path$,Flags)
  Input (0,ResultFmt)

The first field, AX$, contains the function error code, and the second field, DX$, contains the suberror code (aka the Windows file error code). Both of these fields are in Intel 2's complement format, and should be processed as follows: 
  AX$ = SUB(AX$,2,1) + SUB(AX$,1,1)   ! Flip the bytes around
  DX$ = SUB(DX$,2,1) + SUB(DX$,1,1)   ! Flip the bytes around
  FuncError = HexDec(AX$)             ! Function error code (decimal)
  FileError = HexDec(DX$)             ! File error code (decimal)

  ! For unexpected values, convert to 2's complement signed integer
  If (FuncError > 32767) FuncError = FuncError-65536
  If (FileError > 32767) FileError = FileError-65536

Here is a list of the function error codes in decimal form: 
Error
(FuncError) Description 
0 Function not supported 
1 Success 
2 CometAnywhere required 
3 Source file error (see suberrors) 
4 Aborted by user 
5 Function in progress 


Here is a list of the suberror codes (common Windows file errors) in decimal form: 

Suberror
(FileError) Description 
0 Success 
2 File not found 
3 Path not found 
5 Access denied 
12 Invalid access 
15 Invalid drive 
16 An error has occurred in the current directory 
18 No more files 
32 Sharing violation 
33 Lock violation 
80 File exists 
161 Bad pathname 

 
History:  This mnemonic was added in Comet Build 299 and REL Version 01.07.  

(SetOrientation)

 
Mnemonic:   (SetOrientation = mode)  
Discussion:  Sets the paper orientation contained in mode. 
Valid values for mode are: 

DMORIENT.PORTRAIT  Vertical paper alignment  
DMORIENT.LANDSCAPE  Horizontal paper alignment  

 
History:  This mnemonic is valid in Comet98 and greater.  

(SetPaperSize)

 
Mnemonic:   (SetPaperSize=n)  
Discussion:  This mnemonic sets the paper size to n.  
History:  This mnemonic is valid in Comet98 and greater.  

(SetSessionPrinter)

 
Mnemonic:  (SetSessionPrinter=printer-name)  
Discussion:  The (SetSessionPrinter) mnemonic establishes a temporary printer name for the current session. This printer name will be used for session printing as long as the COSW session is active or the printer name is again changed. The session printer is identified in the Comet configuration file by the device name of '#'. 
Example: PtrName$ = "My Printer"
Print (SetSessionPrinter=PtrName$)

 


To clear the temporary printer name, set the printer name to an empty string. This will reset COSW back to the original user-defined session printer. 

Example: Print (SetSessionPrinter="")

 


See (GetSessionPrinter). 
 
History:  This mnemonic was added in Comet2000 Build 300 and requires require REL Version 02.01 or greater.  

(SetTextAlign)

Mnemonic: (SetTextAlign = flags)

Discussion: Sets the text alignment mode to that specified by flags.
The (TextOut) mnemonic uses these flags when positioning a string of text on a display or device.
The flags specify the relationship between a specific point and a rectangle that bounds the text.
The coordinates of this point are passed as parameters to the TextOut member function.
The rectangle that bounds the text is formed by the adjacent character cells in the text string.
The flags specify the relationship between a point and a rectangle that bounds the text.
The point may be either the current position or the coordinates specified by a text-output function.
The rectangle that bounds the text is defined by the adjacent character cells in the text string.
The parameter can be one or more flags from the following three categories.
Choose only one flag from each category.

The first category affects text alignment in the x-direction:
TA.CENTER Aligns the point with the horizontal center of the bounding rectangle.
TA.LEFT Aligns the point with the left side of the bounding rectangle. This is the default setting.
TA.RIGHT Aligns the point with the right side of the bounding rectangle.


The second category affects text alignment in the y-direction:
TA.BASELINE Aligns the point with the base line of the chosen font.
TA.BOTTOM Aligns the point with the bottom of the bounding rectangle.
TA.TOP Aligns the point with the top of the bounding rectangle. (default)

The third category determines whether the current position is updated when text is written:
TA.NOUPDATECP Does not update the current position after each call to a text-output function.
This is the default setting.
TA_UPDATECP Updates the current x-position after each call to a text-output function.
The new position is at the right side of the bounding rectangle for the text.
When this flag is set, the coordinates specified in calls to the TextOut member function are ignored.


History: This mnemonic is valid in Comet98 and greater.

(SetTextColor)

Mnemonic: (SetTextColor = red, green, blue)

Discussion: Sets the current text color as specified by red, green, and blue. Colors are represented by three (Red, Green, Blue) color intensity values, each ranging in value from 0 (no color = black) to 255 (max color = white).

red specifies the amount of RED

green specifies the amount of GREEN

blue specifies the amount of BLUE

History: This mnemonic is valid in Comet98 and greater.

(SetViewportOrg)

Mnemonic: (SetViewportOrg = OffsetLeft, OffsetTop)


Where:

  • OffsetLeft is the distance from the 1st printable left position in TWIPS
  • OffsetTop is the distance from the 1st printable top position in TWIPS


Applies To: Printers only


Discussion: Sets the upper-left position from which printing will be begin. These offsets are from the 1st printable position which on most modern printers is about 1/4 inch from the paper edge. If you’re going to be using printers with different offsets then you may want to query the printer doc info to get the location of the 1st printable position and use that value to calculate what origin (if any) you might want to use. This mnemonic should be issued after opening the printer and before printing begins.


Example:

Simple method to deal with CometPdf which has no unprintable area.

Open (Lun) "LPF" ! open printer
! Set the upper left point of origin to 1/4 inch from left and top.
Print (Lun) (TR);(SetViewportOrg = 360, 360) ! 1440 TWIPS/inch
.
.

(SF)

Mnemonic: (SF) Hex equivalent: "@0A@" Discussion: Start foreground display. The (SF) control code sets foreground display mode and causes subsequent characters to be displayed as foreground characters.

Note: The default display mode is foreground.

Characteristics of foreground mode:

Foreground mode is used for keyboard data entry and for program display of data for operator modification and subsequent transmission to the program.

Foreground characters appear in the configured foreground color.

The cursor may be positioned anywhere within the boundaries of a foreground field.

Pressing the Tab key while the cursor is in a foreground field moves the cursor to the beginning of the next foreground field, skipping over any intervening background display areas. If the cursor moves forward past a transmit delimiter (a (TM) or (TP) mark), data will be transmitted to the receiving field(s) in the program.


Foreground and background can be mixed in one FORMAT statement, as long as the appropriate control codes (i.e., (SF) and (SB)) are used to start each operation.

Example: 100 FORMAT (SB);"ENTER CODE NUMBER:";(TM);(SF);" ";(TM);@(0,0)

   .
   PRINT (0,100)
   INPUT (0) CODE$

This example shows how to use the start foreground control code in the middle of a FORMAT statement. This FORMAT starts out by entering background mode and displaying a program prompt. Next, the program places a transmit mark, switches to foreground, displays 5 blanks, places another transmit mark, and returns the cursor to "home" position (column 0, row 0).

(Shell to DOS)

 
Mnemonic:   (Shell to DOS=ARG1$)  
Hex equivalent:  "@0E0E0A00@"  
Discussion:  This mnemonic shells to DOS. 
ARG1$ is a string constant or variable containing a DOS command or program name. If ARG1$ is null, the DOS command prompt will be displayed. 

The shell to DOS feature is intended for single user Comet systems only (networked or standalone). 

When this instruction is executed, the Comet environment (base memory only) is written to disk. Comet writes this data on the first configured local RAM drive. If no local RAM drive is configured, Comet writes this data to the current DOS directory on the hard drive. 

This feature requires DOS 6.22 or later. 

Returning to Comet: 

If a DOS command is not passed to the DOS shell, you can return to Comet by typing EXIT at the DOS prompt. This restarts Comet and returns to the next instruction following the (Shell to DOS) instruction. 

If a DOS command is passed to the DOS shell, Comet is restarted automatically when the DOS program is done. You are returned to the next instruction following the (Shell to DOS) instruction. 
Also see (Launch). 
 
History:  Starting with Comet98 Build 231, this mnemonic launches a Windows application.  
Example 1:  a. 100 FORMAT (Shell to DOS)
   .
   PRINT (0,100)

b. PRINT (0) (Shell to DOS)

This example shells to DOS and displays the DOS command prompt.  
Example 2:  a. 100 FORMAT (Shell to DOS="DIR C:\ /p")
   .
   PRINT (0,100)

b. PRINT (0) (Shell to DOS="DIR C:\ /p")

This example shells to DOS and performs the DIR command on the root directory of drive C:, using the /p parameter to pause the display when the screen is full.  

(ShellExecute)

 
Mnemonic:  (ShellExecute=Action$, File$, Args$, WorkDir$,WinMode)  
Discussion:  This mnemonic launch a Windows program or document. It is used with the system driver (X00) or TERM$. 
The parameters are: 

Action$ = A verb associated with the file type. Typically "open" or "play". To specify the default action, use "". You can see the verbs for a given file type from the File Types dialog available via the "View/Folder Options" menu item (in Windows Explorer). 

Prog$ = The name of a program (e.g., notepad.exe) or a document (e.g., myfile.txt) 

Args$ = Additional command line arguments 

WorkDir$ = The current directory to use when executing the Prog$ 

WinMode = 

0 Hides the window and activates another window.  
1 Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.  
2 Activates the window and displays it as a minimized window.  
3 Activates the window and displays it as a maximized window.  
4 Displays a window in its most recent size and position. The active window remains active.  
5 Activates the window and displays it in its current size and position.  
6 Minimizes the specified window and activates the next top-level window in the Z order.  
7 Displays the window as a minimized window. The active window remains active.  
8 Displays the window in its current state. The active window remains active.  
9 Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.  
10 Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.  


Also see (ShellExecuteWait). 
 
History:  This mnemonic was added in REL 00.06. Support for TERM$ was added in REL 02.04.  
Example 1:  The following code launches the NOTEPAD program. 
PRINT (0) (ShellExecute="open","notepad.exe","","",1)

where: 
Parameter 1 (open) is the action associated with an EXE file 
Parameter 2 (notepad.exe) is the program name 
Parameters 3 and 4 are not needed in this case (thus the "") 
Parameter 5 (1) activates and displays a window 
 
Example 2:  The following code launches the NOTEPAD program. The system driver (X00) is opened on Logical Unit Number 20. 
OPEN (20) "X00"
PRINT (20) (ShellExecute="open","notepad.exe","","",1)
CLOSE (20)

where: 
Parameter 1 (open) is the action associated with an EXE file 
Parameter 2 (notepad.exe) is the program name 
Parameters 3 and 4 are not needed in this case (thus the "") 
Parameter 5 (1) activates and displays a window 

(ShellExecuteWait)

 
Mnemonic:  (ShellExecuteWait=Action$, File$, Args$, WorkDir$,WinMode)  
Discussion:  This mnemonic launches a Windows program and pauses the InternetBasic program. When the Windows program is done, the IB program resumes. 
The parameters are: 

Action$ = A verb associated with the file type. Typically "open" or "play". To specify the default action, use "". You can see the verbs for a given file type from the File Types dialog available via the "View/Folder Options" menu item (in Windows Explorer). 

Prog$ = The name of a program (e.g., notepad.exe) or a document (e.g., myfile.txt) 

Args$ = Additional command line arguments 

WorkDir$ = The current directory to use when executing the Prog$ 

WinMode = 

0 Hides the window and activates another window.  
1 Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.  
2 Activates the window and displays it as a minimized window.  
3 Activates the window and displays it as a maximized window.  
4 Displays a window in its most recent size and position. The active window remains active.  
5 Activates the window and displays it in its current size and position.  
6 Minimizes the specified window and activates the next top-level window in the Z order.  
7 Displays the window as a minimized window. The active window remains active.  
8 Displays the window in its current state. The active window remains active.  
9 Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.  
10 Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application.  


Also see (ShellExecute). 
 
History:  This mnemonic was added in REL 02.04.  
Example:  PRINT (0) (ShellExecuteWait="open","program.exe","","",1)

where: 
Parameter 1 (open) is the action associated with an EXE file 
Parameter 2 (program.exe) is the program name 
Parameters 3 and 4 are not needed in this case (thus the "") 
Parameter 5 (1) activates and displays a window 
 


(Show Cursor)

 
Mnemonic:   (Show Cursor)  
Discussion:  This mnemonic shows the regular cursor. 
See Regular cursor display for more information. 

Also see (Hide Cursor). 
 
Example:  a. 100 FORMAT (Show Cursor)
   .
   PRINT (0,100)

b. PRINT (0) (Show Cursor
 

(Show Mouse Cursor)

 
Mnemonic:   (Show Mouse Cursor)  
Hex equivalent:  "@0E0901@"  
Discussion:  This control shows the mouse cursor. 
Also see (Hide Mouse Cursor). 
 
Example:  a. 100 FORMAT (Show Mouse Cursor)
   .
   PRINT (0,100)

b. PRINT (0) (Show Mouse Cursor)

(Single Key Transmit)

 
Mnemonic:   (Single Key Transmit)  
Hex equivalent:  "040002@"  
Discussion:  This mnemonic sets the "single key transmit" mode, in which a single keystroke causes an immediate transmission of data to the program (without pressing Enter or crossing past a transmit mark). 
This mode must be reset each time it is to be used. 
 
Example:  a. 100 FORMAT (Single Key Transmit)
   .
   PRINT (0,100)
   INPUT (0) DATA$                    ! wait for next keystroke

b. PRINT (0) (Single Key Transmit)
   INPUT (0) DATA$                    ! wait for next keystroke

(SL)

 
Mnemonic:   (SL=n)  
Discussion:  The (SL=n) control code causes the printer to skip n lines, where n is an integer between 1 and 999. This control performs the same function as multiple line feeds.  
Example:  a. 100 FORMAT (SL=10)
   .
   OPEN (1) "LP1"
   .
   PRINT (1,100)


b. OPEN (1) "LP1"
   .
   PRINT (1) (SL=10)

This example uses the (SL=n) control code to skip 10 lines.  

(SSB)

 
Mnemonic:   (SSB)  
Hex equivalent:  "@040C@"  
Discussion:  Start suppressed background display. 
The (SSB) control code sets suppressed background display mode. Subsequent data is displayed as background blanks in the configured color for invisible fields. The cursor cannot be positioned in a suppresed background field. 

Note: Certain control codes, such as transmit marks and right-justify marks, automatically appear as suppressed background fields. All other data attempted to be displayed in suppressed background mode will be displayed as blank spaces (invisible, protected from the cursor). 
 
Example:  a. 100 FORMAT ... (SSB);(BF);(BF);(BF)
   .
   PRINT (0,100)

b. PRINT (0) ... (SSB);(BF);(BF);(BF)

In this example, the PRINT ends with three blank fill control codes -- these display three lines of blanks in suppressed background, the mode set just before the last three controls.  

(Std Keyboard Off)

 
Mnemonic:   (Std Keyboard Off)  
Hex equivalent:  "@0E0006@"  
Discussion:  This mnemonic turns off the standard keyboard mode.  
Example:  a. 100 FORMAT (Std Keyboard Off)
   .
   PRINT (0,100)

b. PRINT (0) (Std Keyboard Off)

(Std Keyboard On)

 
Mnemonic:   (Std Keyboard On)  
Hex equivalent:  "@000E05@"  
Discussion:  This mnemonic turns on the standard keyboard mode.  
Example:  a. 100 FORMAT (Std Keyboard On)
   .
   PRINT (0,100)

b. PRINT (0) (Std Keyboard On)

(StoreControl)

 
Mnemonic:  (StoreControl = cosDlghDlg$, CntrlID, filename$)  
Discussion:  This mnemonic stores the text from a multi-line edit control in a text file. 
cosDlghDlg$ is the handle to the dialog
CntrlID is the control identifier for the edit control
filename$ is the full pathname of a text file 
 
Example:  Print (LoadControl = cosDlghDlg$, IDC.COMMENTS, ComFile$)

(Subject)

 
Email Mnemonic:   (Subject=string-argument)  
Discussion:  The (Subject) mnemonic may be used to specify the subject line for your email message.  
Example:  OPEN (1) "LEH"
PRINT (1) (Subject="Party at Jim's house@!")

 
 Read about other Email Mnemonics   

(Switch Session)

 
Mnemonic:   (Switch Session=numeric-argument)  
Hex equivalent:  "@0E0Cxx@" 
where:
xx = session (hex) 
 
Discussion:  This mnemonic switches to another avtive Comet session. The numeric-argument (a constant or variable) determines what action will be taken, based on the following values: 
Value   Action
==============================
0       switch to next session
1       switch to session 1
2       switch to session 2
3       switch to session 3
4       switch to session 4
5       switch to session 5
6       switch to session 6
7       switch to session 7
8       switch to session 8

Use the following statement to determine the session number associated with the partition where your program is running (PARTITION$): 
SessionNum = ASC(SUB(PSTAT(PARTITION$), 60, 1))

Session numbers are base 1 (1 added) for foreground partitions. If PSTAT returns a session number of 0, it is a background partition. Otherwise the actual session number is SessionNum-1.  
Example:  a. 100 FORMAT (Switch Session=0)
   .
   PRINT (0,100)                 ! switch to next Comet session

b. PRINT (0) (Switch Session=0)  ! switch to next Comet session

System driver (X00) mnemonics

Mnemonic  Description  
(Copy from Clipboard)  Copy contents from Windows clipboard  
(Copy to Clipboard)  Write data to Windows clipboard  
(Shell Execute)  Launch Windows program  
(Query Clipboard)  Determine if Windows clipboard contains data  

Personal tools