Monarchâ 9460ä ADK Printer TC9460ADKPM Rev. AC 1/08 ©2003 Paxar Americas, Inc. a subsidiary of Avery Dennison Corp. All rights reserved.
Each product and program carries a respective written warranty, the only warranty on which the customer can rely. Paxar reserves the right to make changes in the product and the programs and their availability at any time and without notice. Although Paxar has made every effort to provide complete and accurate information in this manual, Paxar shall not be liable for any omissions or inaccuracies. Any update will be incorporated in a later edition of this manual. ©2003 Paxar Americas, Inc.
TA B L E O F C O N T E N T S Overview ................................................................................................................................1-1 How to Use this Manual .........................................................................................................1-1 A Review of Terms ................................................................................................................1-1 Using the Software .........................................................
Command Reference ...............................................................................................................5-1 Programming Conventions .....................................................................................................5-1 Field Names .........................................................................................................................5-1 Keywords ........................................................................................................
DISABLE ............................................................................................................................ 5-36 DIVIDE .............................................................................................................................. 5-37 ENABLE ............................................................................................................................. 5-38 EXIT ............................................................................................
SWITCH ............................................................................................................................. 5-78 SYSSET ............................................................................................................................. 5-80 TOKEN .............................................................................................................................. 5-82 TSTRIP ...........................................................................................
1 OVERVIEW The Application Development Kit II (ADK2) is a product for Microsoft Windows 95/98/Me/NT/2000. It allows you to create an application program to run on the printer. You write the script with the ADK2 command language. You can program the printer to: ♦ print labels or tags ♦ print data streams written for other printers You can define lookup tables for the script running on the printer. It also allows you to define records such as temporary storage buffers.
1-2 Overview
2 USING THE SOFTWARE This chapter explains how to ♦ start a new project. ♦ build a project into an application. ♦ download an application. System Requirements Here are the recommended system requirements. Recommended Computer Personal computer with Microsoft Windows 95/98/Me/NT/2000 Processor Pentium – 150 Mhz Memory 32 Meg Disk space 5-10 Meg Communications Port Serial Printer Monarch Sierra Sport 2 Installing the Software 1. From the Start menu, run the file SETUP.EXE. 2.
Getting Started 1. Start the ADK2 software. You will see Project Tree W orking Area Builder Output The screen has three major sections: the Project Tree, Working Area, and Builder Output. You can use the View menu to change which areas appear on your screen. ♦ The Project Tree lists all the files in the open project. See “About Projects” for more information. ♦ The Working Area is the text editor for the files in the project.
6. Select New from the File Menu to start writing a script. Initial comments are automatically added in the Working Area of the screen. As you type your script, the ADK2 keywords appear in blue and the script text also appears in different colors, depending on what the text item is. To change the keyword colors, the text to upper or lower case, or show white space, right mouse click in the Working Area of the screen and make the appropriate selection. If you select Properties, you will see 7.
Saving a File Select Save from the File menu. The default sub-directory is \Scripts in the selected project directory. The file is saved with .CFS extension (configuration source). The first time you save the file, it will prompt you if you want to add this file as a script in the currently open project. About Projects The Project Tree lists all the files in the open project. The project tree contains the following directories: scripts, formats, and lookups.
Lookups Add lookup tables to the \Lookups directory for use in the current project. 1. Highlight the \Lookups directory. 2. Right mouse click and select Add Files to Folder. 3. Locate and select the lookup table to add. Click Open. NOTE: If you do not use the LOOKUPDEF command in the script, when the script is downloaded, you are prompted for the lookup file. Example: Define SCRATCH, 5000, A LOOKUPDEF c:\ADKProjects\MyStore\Lookups\prices.txt Function Start Begin . . .
If you select COM1 - COM4: 4. Make changes as needed to the Baud, Parity, Data Bits, Stop Bits, and Flow Control. Click f twice. NOTE: Changing these parameters only affects your PC, not the connected printer. Refer to your printer’s documentation for more information about changing the printer’s communications parameters. If you select LPT1 – LPT2: Compatible mode is for uni-directional communications.
If you select TCPIP: 4. Enter your printer’s TCP/IP Address. See your System Administrator for more information. 5. Enter your printer’s TCP/IP Port (typically 9100). See your System Administrator for more information. 6. Determine appropriate bi-directional setting: 7. ♦ Disabled/Unchecked is for uni-directional communications. With this mode, you can send files to your printer, but you will not receive printer status information.
2-8 Using the Software
PRINTER PROCEDURES 3 Applications should be written so that they run continuously when the machine is on. However, there may be instances where you need to “go behind the scenes” to troubleshoot the printer, reload an application, perform maintenance or set parameters. Displaying the Ready Prompt Before doing anything, you must display the Ready prompt on the printer. Ready p X How you do this depends on whether the printer has an application loaded.
3. Press the right A button (under the T icon). The following menu appears. Tool Box Language Exit E 4. Choose Tool Box. Note: 5. D When you exit the tool box, the Ready prompt appears. Use the tool box to perform the tasks you need to do. See the System Administrator’s Guide for more information. Loading Applications After you use the tool box, you must restart the existing application or load a new one. Restarting Existing Applications To restart the application (after using the tool box): 1.
PROGRAM STRUCTURE 4 This chapter discusses program flow control, buffer definitions, and other useful information for writing your script. Below is a sample of what a script may look like. DEFINE TEMPORARY, RegPrice, 6, A DEFINE TEMPORARY, NewPrice, 6, A DEFINE PRINTER, PrtRegPrice, 7, A DEFINE PRINTER, PrtNewPrice, 7, A FUNCTION Start BEGIN CALL InitApp CALL GetRegPrice CALL GetNewPrice CALL PrintTags END FUNCTION InitApp BEGIN CLEAR Printer CLEAR RegPrice . . . END . . .
Starting a Script Every script has the primary function START. The START function is the starting point of your program. Script execution control starts with the first command in START, and stops when the last command in START is performed. FUNCTION START BEGIN . program-body . END Files and Buffers The Lookup table is a collection of records. Data is stored in the printer as an ASCII flat file. You can tell the printer how to store defined buffers in memory.
Printer Definition The printer buffer is used to store data to print. Rule: The field lengths in the printer buffer must equal the length of the largest corresponding field in the formats. For example, if... the length of Field 1 of Format 1 is 7 the length of Field 1 of Format 2 is 22 the length of Field 1 of Format 3 is 12 Then, the first field's length in the printer buffer must be 22. Arrays You can use an array to store data similar to temporary storage.
Comments in a Script You must precede comments by a semicolon. The software treats them as a single white space and ignores them. ;********************************************************* ;* ;* Description ;* This is the main entry point of ;* the script. Gets the Date and ;* then starts processing.
5 COMMAND REFERENCE This chapter lists, in alphabetical order, the commands you use to write your script. Each command is discussed in detail to include the correct syntax. Programming Conventions The commands use the following conventions. KEYWORDS You must type the upper-case text. CALL function-name Place holders Text in italics are place holders. CLEAR item [optional] Optional items appear in brackets.
Keywords The following keywords are reserved by the compiler. Do not use them as identifiers. 1200 DTRDTE NONE 1200 19.
LEFT LINKFILE LINKFMT LOCATE LOOKUP LOOKUPDEF LOOKUPFILE LOOKUPSIZE LOWER LSTRIP MACRO MARK MID MOVE MULTIPLE MULTIPLY NONE NUMBERPRINTED ODD ONDEMAND OPENCOMM PACKRECORDS PAD PARITY PARSE PRINT PRINTER PROMPTS QUERY RAM RAVAIL RCLOSE READ RECORDDELETE RESPONSE RESTORESCREEN RETURN REVVID RIGHT ROPEN RREAD RSTRIP RTSCTS RWRITE SAVESCREEN SCANLEN SCANNER SCRATCH SEEK SETDATE SHUTDOWN SKIP SPACE START STATUSPOLLING STOPBITS STRIPS SUB SUSPEND SWITCH
Special Characters The following special characters are reserved for the printer. Do not use them in your script. { left brace _ underscore | pipe or split vertical bar } right brace ~ tilde \ backslash ` grave accent However, you can use these characters in a string with quotation marks. Use the tilde character (~) along with the corresponding ASCII code in strings to represent nonprintable characters. For example, ~013 represents a carriage return.
Functional Relationships Some commands logically work together or are related in function. The commands are discussed in the following functional groups. Math Commands ADD Adds the numeric values of two fields. DEC Decrements numeric fields. DIVIDE Divides the contents of one field by the contents of another. INC Increments numeric fields. MULTIPLY Multiplies the contents of one field by the contents of another field. SUB Subtracts the contents of one field from the contents of another field.
Data Manipulation Commands ARGREAD Extracts an argument from a comma-delimited string. ASC Converts ASCII data from a numeric format to an alphanumeric format. BITCLEAR Sets the specified bit to zero. BITMASK Allows bit logical operations on buffers. BITSET Sets the specified bit to one. BITSHIFT Allows bits within a value to be arithmetically shifted left or right. BITTEST Checks the specified bit to see if the bit is a one or a zero.
File Management Commands APPVERSION Sets the script name and version number. BSEARCH Performs a binary search on a sorted lookup table for a record containing a specific value. QUERY Searches a lookup file to find a record containing a specific value. READ Copies the current record from the lookup file into the appropriate working buffer. SEEK Positions the current record within the lookup file. Input/Output Commands AUTOSTART Executes the script immediately after download is complete.
ADD Purpose Adds the numeric values of two fields. Syntax ADD buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The ADD command sums buffer-field1 and buffer-field2 and places the result into buffer-field2 .
APPVERSION Purpose Sets the version string of the ADK application. Syntax APPVERSION “ string1 ”, “ string2 ” Process The APPVERSION command has string1 appear on the screen’s first line and string2 on the screen’s second line. String1 and string2 can be up to 16 characters long. Example This example displays AP11 on the screen’s first line and VER 1.0 on the second line. APPVERSION “AP11”, “VER 1.
ARGREAD Purpose Extracts field data from one field and places it in another. Syntax ARGREAD raw-data , destination , index [ , [ invalid label ] [ , valid label ] ] Process The ARGREAD command extracts data from raw-data and places it in destination .
ASC Purpose Converts numeric data to alphanumeric data. Syntax ASC int-field , asc-field Process The ASC command converts numeric data from int-field and places the resulting alphanumeric data in asc-field .
AUTOSTART Purpose Starts the application immediately after it is downloaded to the printer. Syntax AUTOSTART Process The AUTOSTART command starts the application immediately after it is downloaded to the printer. Place it anywhere in the application code, but use it only once. Example This example specifies that the application should start immediately after download to the printer.
AVAILABLEDATA Purpose Checks for data at a device. Syntax AVAILABLEDATA device [ , [ invalid label ] [ , valid label ] ] Process The AVAILABLE command checks for data at a device . The device field can be one the following: Optional Fields Device Description KEYBOARD Keypad COMM Communications Port Invalid and valid labels are discussed in "Script Flow" at the beginning of this chapter.
BITCLEAR Purpose Sets the specified bit to zero. Syntax BITCLEAR buffer-field, bit-position [ , [ invalid label ] [ , valid label ] ] Process The BITCLEAR command sets the specified bit by bit-position in buffer-field to zero. Bit-position can be 0 to 15. If bit-position is out of range and invalid label is defined, control passes to that label.
BITMASK Purpose Allows bit logical operations on buffers. Syntax BITSET operation , buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] use the above syntax for logical AND/OR or logical exclusive OR. BITMASK operation , buffer-field1 [ , [ invalid label ] [ , valid label ] ] use the above syntax for Invert. Process The BITMASK command allows bit logical operations on buffer-field1 .
BITSET Purpose Sets the specified bit to one. Syntax BITSET buffer-field1 , bit-position [ , [ invalid label ] [ , valid label ] ] Process The BITSET command sets the specified bit by bit-position in buffer-field to one. Bit-position can be 0 to 15. If bit-position is out of range and invalid label is defined, control passes to that label. RULE: Both buffer-field1 and bit-position must be numeric.
BITSHIFT Purpose Allows bits within a value to be arithmetically shifted left or right. Syntax BITSHIFT direction , buffer-field1 , count [ , [ invalid label ] [ , valid label ] ] Process The BITSHIFT command allows bits within a value to be arithmetically shifted left or right. Shifts count bits in buffer-field in the direction specified by direction . Count can be 1 to 16.
BITTEST Purpose Checks the specified bit to see if the bit is a one or a zero. Syntax BITTEST buffer-field1 , bit-position [ , [ invalid label ] [ , valid label ] ] Process The BITTEST command checks the specified bit by bit-position in buffer-field1 . Bitposition can be 0 to 15. If the bit specified by bit-position is zero (cleared) and invalid label is defined, control passes to that label. If the bit specified by bitposition is one (set) and valid label is defined, control passes to that label.
BSEARCH Purpose Performs a binary search on a sorted lookup table to find a record containing a specific value. Syntax BSEARCH lookup-field , value [ , [ invalid label ] [ , valid label ] ] Process The BSEARCH command searches lookup-field for value . The script determines which lookup table to use by the field you specify (every field name must be unique over all lookup tables).
CALL Purpose Calls a section of code as a subroutine. Syntax CALL function-name [ ( param1, param2, …,paramX ) ] Process The CALL command executes an out-of-line function. After execution, control returns to the command following the CALL command. The CALL function allows parameters to passed to the called function. The called function function-name must have a DEFINE LOCAL for local storage for each parameter that is passed to it.
Example 2 This example shows the use of local variables. The function ADDNUM has two local variables defined that receive the parameters passed from the call. The first parameter (#5) is placed in the TfirstNum field and the second parameter (#6) is placed in the TsecondNum field. The TSum variable is defined as a global Temporary variable and is accessible from any functions in the script. DEFINE TEMPORARY, TSum, 10, N FUNCTION START BEGIN . . . CALL ADDNUM (#5, #6) . . .
CHARTYPE Purpose Allows you to limit the character type for an input buffer. Syntax CHARTYPE type , buffer-field1 Process The CHARTYPE command restricts the character type applied to an input buffer using type and buffer-field1 . NOTE: This command does not affect the FETCH command. Type describes the contents of buffer-field1 .
CHECK Purpose Checks the status of a specified system parameter. Syntax CHECK item [, buffer-field ] [ , [ invalid label ] [ , valid label ] ] Process The CHECK command checks the status of item . Item can be one of the following: Item Description BATTERY Battery Voltage COMM Communications Port PRINT Print Buffer-field is required if item is COMM or PRINT. It is a field where the status of the parameter is returned.
Buffer-field can be one of the following: Optional Fields Buffer-field Description INPUT Input Buffer Logical Field Name (TEMP1) Temporary Buffer Field Logical Field Name (LU1) Lookup Buffer Field Logical Field Name (PR1) Printer Buffer Field Invalid and valid labels are discussed in "Script Flow" at the beginning of this chapter. Example This example checks the battery level. If the level is low, control of the application branches to the *LOWBATTERY label.
CHR Purpose Converts alphanumeric data to numeric data. Syntax CHR asc-field , int-field Process The CHR command converts asc-field (containing alphanumeric data) to a numeric format, placing the result in int-field . Asc-field and Int-field contain the data to translate and the translated data, respectively.
CLEAR Purpose Deletes data from data items. Syntax CLEAR item Process The CLEAR command deletes data from item . Control always passes to the next line. NOTE: You must define a buffer before you can clear it. Item is the data item to clear.
CLOSECOMM Purpose Closes either the primary or secondary communications port. Syntax CLOSECOMM commport Process The CLOSECOMM command closes communications port referenced by commport . It can contain 1 for the primary port or 2 for the secondary port. Commport is the communications port to close.
COMPARE Purpose Compares the contents of two fields. Syntax COMPARE buffer-field1 , modifier , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The COMPARE command compares the two buffer fields, based on modifier .
CONCAT Purpose Appends the contents of one field to another. Syntax CONCAT source , destination [ , [ invalid label ] [ , valid label ] ] Process The CONCAT command copies source 's contents to the end of destination 's contents. Source 's contents do not change. Source is the data to append . Destination is the resulting data .
CSTRIP Purpose Strips data from a field. Syntax CSTRIP field-buffer1 , field-buffer2 [ , [ invalid label ] [ , valid label ] ] Process The CSTRIP command strips data specified in field-buffer2 from field-buffer1 .
DATATYPE Purpose Restricts the type of data the GET statement can retrieve. Syntax DATATYPE data-type Process The DATATYPE command restricts the GET statement to only read data of type data-type . Data-type can contain one of the following values.
DEC Purpose Decrements numeric fields by one. Syntax DEC buffer-field [ , [ invalid label ] [ , valid label ] ] Process The DEC command decrements buffer-field . A translation error occurs if the script decrements an alphanumeric field.
DEFINE Purpose Defines the field definitions for the buffers. Syntax To define a SCRATCH buffer... DEFINE field-type , field-length , data-type To define TEMPORARY or PRINTER buffers... DEFINE field-type , field-name , field-length [ , data-type ] To define an ARRAY buffer... DEFINE field-type , field-name , field-length , number-of-elements [ , data-type ] To define a LOOKUP buffer...
Example 1 This example defines the temporary buffer field CURR_QTY as a numeric field with a length of 4 bytes. DEFINE TEMPORARY,CURR_QTY,4,N Example 2 This example shows the use of local variables. The function ADDNUM has two local variables defined that receive the parameters passed from the call. The fist parameter (#5) is placed in the TfirstNum field and the second parameter (#6) is placed in the TsecondNum field.
DELAY Purpose Delays the current script for a specified time. Syntax DELAY # interval Process The DELAY command suspends the printer's current script for the number of tenths of seconds specified by interval . The interval range is 1 - 255.
DISABLE Purpose Turns off the specified hot keys. Syntax DISABLE hotkey1 [, hotkey2 ][, hotkey3 ] Process The DISABLE command turns off the specified hot keys. You must turn on the hot keys (with the ENABLE command) before using this command. Hotkey1, hotkey2, and hotkey3 can be one of the following: Example Hotkey1, Hotkey2, and Hotkey3 Description F1 Function Key 1 F2 Function Key 2 F3 Function Key 3 ALL All function keys This example disables the F1, F2, and F3 hot keys.
DIVIDE Purpose Divides the contents of one field by the contents of another. Syntax DIVIDE buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The DIVIDE command divides buffer-field1 by buffer-field2 and inserts the quotient into buffer-field2 . This command performs integer division and truncates the remainder. Buffer-field1 contains the dividend while buffer-field2 is the divisor.
ENABLE Purpose Turns on the specified hot keys. Syntax DISABLE hotkey1 [, hotkey2 ][, hotkey3 ] Process The DISABLE command turns on the specified hot keys. You must turn on the hot keys (with the ENABLE command) before using this command (the default is off).
EXIT Purpose Leaves the current script. Syntax EXIT Process The EXIT command returns control back to normal printer operation unless you specify AUTOSTART. To restart the script, enable the script through the printer’s control panel. Example This example shows the script's termination.
FETCH Purpose Retrieves one character from up to two sources and places it in the Input Buffer. Syntax FETCH src1 [ , src2 ] [ , [ invalid label ] [ , valid label ] ] Process The FETCH command retrieves one character from src1 and optionally, src2 . It places these characters in the Input Buffer. NOTE: The DATATYPE and CHARTYPE commands do not affect this command.
FIELDLEN Purpose Places the length of a field into another field. Syntax FIELDLEN buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The FIELDLEN command calculates the length of buffer-field1 and places it in buffer-field2 .
FIXDATA Purpose Defines fixed data for an input buffer. Syntax FIXDATA buffer-field1 Process The FIXDATA command defines fixed data for the input buffer. Use this command with the CHARTYPE command, which provides a template. Buffer-field1 contains a string inserted into the input buffer.
GENERATE Purpose Generates a check digit. Syntax GENERATE buffer-field , type [ , [ invalid label ] [ , valid label ] ] Process The GENERATE command generates a check digit for the value in buffer-field . Type specifies the check digit scheme to use.
GET Purpose Retrieves data from up to two input devices. Syntax GET src1 [, src2] , minimum , maximum [ , type ] [ , [ invalid label ] [ , valid label ] ] Process The GET command retrieves data from src1, and optionally, src2, and places it in the input buffer. Src1 and src2 can be one of the following: Src1 and Src2 Description COMM Communications port KEYBOARD Keypad Minimum and maximum represent the field length.
HOTKEY Purpose Defines hot keys. Syntax HOTKEY key , function-name Process The HOTKEY command defines key , specifying that the application should call function-name when the operator presses it. Key can be one of the following: Example Key Description F1 Function Key 1 F2 Function Key 2 F3 Function Key 3 This example specifies that, when the operator presses F3, the application calls the QUERY_LOOKUP function.
IF Purpose Performs a series of one or more commands if a certain condition exists. Syntax IF buffer-field1 comparison buffer-field2 . . . [ELSEIF buffer-field2 comparison buffer-field4 ] . . . [ELSE] . . . ENDIF Process The IF command directs script flow by determining if a condition or series of conditions exist. A condition is specified by comparing buffer fields. If the comparison is true (the condition exists), the script executes the commands on the lines following the condition.
Comparison can be one of the following: Optional Fields Comparison Description = Equals == Equals <> Not equal != Not equal > Greater than >= Greater than or equal < Less than <= Less than or equal ELSEIF provides another set of commands to execute if another condition exists. For example, IF NAME == "JOHNSON" INC JCOUNT ELSEIF NAME == "SMITH" INC SCOUNT ENDIF counts the number of records where NAME is Johnson or Smith. The first condition is (NAME equals Johnson).
INC Purpose Increments numeric fields by one. Syntax INC buffer-field [ , [ invalid label ] [ , valid label ] ] Process The INC command increments buffer-field .
INCLUDE Purpose Inserts another source file into the script. Syntax INCLUDE pathname Process The INCLUDE command signals the compiler to insert the source statements located in the file pathname , into the current script. Rule: Example 1 Nested INCLUDE statements are not allowed. But, multiple INCLUDE statements in one file are allowed. This example inserts the source file TRUCKIN.ULT into the current script. INCLUDE TRUCKIN.ULT Example 2 This example inserts the source file SPECIAL.
INSERT Purpose Inserts data from one buffer into another. Syntax INSERT overwrite-flag , buffer-field1 , buffer-field2 , position [ , [ invalid label ] [ , valid label ] ] Process The INSERT command inserts data from buffer-field1 into bufferfield2 at a specified position .
JUMP Purpose JUMP transfers control to another location. Syntax JUMP label Process The JUMP command unconditionally transfers control to the specified label. If the script is re-entered, control passes to the script's first line. Rule: Example You cannot jump out of a function. This example transfers control to the label *REQUEST_SKU.
LABELCOUNT Purpose Sets a field to the current number of labels printed. Syntax LABELCOUNT buffer-field1 [ , [ invalid label ] [ , valid label ] ] Process The LABELCOUNT command sets buffer-field1 to the current number of labels printed.
LEFT Purpose Extracts the left-most character from a string. Syntax LEFT buffer-field1 , buffer-field2 , length [ , [ invalid label ] [ , valid label ] ] Process The LEFT command extracts the left-most characters from buffer-field1 and copies them into buffer-field2 . Length specifies the number of characters.
LINKFILE Purpose Links formats, files, or packets to the script. Syntax For files or packets created using a text editor. LINKFILE file-name Process The LINKFILE command links formats to the script. You can include any number of files in the download datastream. The LINKFILE command downloads formats, files, or packets created using a text editor. These commands add a line to the .CFU file's header which tells the transfer program to download the file specified by format-name\file-name .
LOCATE Purpose Moves the cursor to a specified position on the printer’s screen. Syntax LOCATE row-position, col-position Process The LOCATE command moves the cursor to the ( row-position , col-position ) position on the printer’s screen. The range for row-position is 1-3. For col-position the ranges are 1-15 (for rows 1 and 2) and 1-20 (for row 3).
LOWER Purpose Converts characters in a field from upper-case to lower-case. Syntax LOWER source Process The LOWER command converts characters in source to lower-case characters.
LSTRIP Purpose Strips characters from a field, and copies the remaining characters to another field. Syntax LSTRIP field-buffer1, field-buffer2, field-buffer3 [ , [ invalid label ] [ , valid label ] ] Process The LSTRIP command strips the left-most characters from field-buffer1 and copies the remaining characters to field-buffer2 . Field-buffer3 is the number of characters to strip.
MACRO Purpose Defines or invokes a single command the software expands to multiple commands during script translation. Syntax To define the macro ... MACRO macro-name BEGIN macro-body END To invoke the macro ... macro-name arg1 , arg2 , ... , arg99 Process NOTE: The MACRO command defines or invokes a macro. A macro is a single command the software expands to multiple commands during script translation. Each time a macro command appears, the software inserts the commands it generates into the script.
Example This example defines a macro (PTRIDLE) to check the status of the printer.
MID Purpose Extracts a sub-field from a string. Syntax MID buffer-field1 , buffer-field2 , start , length [ , [ invalid label ] [ , valid label ] ] Process The MID command extracts a sub-field from buffer-field1 and copies it into bufferfield2 ; starting with the start position and extracting length number of characters.
MOVE Purpose Copies data between fields. Syntax MOVE source , destination [ , [ invalid label ] [ , valid label ] ] Process The MOVE command copies data between fields. The contents of source replaces the contents of destination with no effect on source .
Destination can be one of the following: Destination Description INPUT Input Buffer DISPLAY The Printer’s Screen SCRATCH Scratch Buffer Logical Field Name (TEMP1) Temporary Buffer Field Logical Field Name (LU1) Lookup Buffer Field Logical Field Name (PR1) Printer Buffer Field Logical Field Name (Field1) [Index] Array Buffer Field Buffer-field1, start, and length only: Number Number prefixed by a number sign (#) Buffer-field1 only: String ASCII string delimited by double quotes You can mo
MULTIPLY Purpose Multiplies the contents of one field by the contents of another. Syntax MULTIPLY buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The MULTIPLY command multiplies buffer-field1 by buffer-field2 , inserting the product into buffer-field2 . The maximum value for the buffer-field1 , buffer-field2 , and the result is 429,496,795.
OPENCOMM Purpose Opens either the primary or secondary communications port. The port stays open until it is closed with CLOSECOMM. Syntax OPENCOMM commport , timeout Process The OPENCOMM command opens the communications port referenced by commport (1 for the primary port or 2 for the secondary port). Timeout defines the length of time (0-255, in seconds) that the printer waits for data during a GET or FETCH. If a timeout occurs, control passes to the GET or FETCH invalid label.
PAD Purpose Pads data in a field. Syntax PAD direction , pad-field , pad-character , max-length Process The PAD command pads data in pad-field , in the direction specified by direction , with pad-character . Max-length indicates the field's length. For example, if the data is seven characters and the length is ten, three characters are added to the field.
PARSE Purpose Processes an MPCL data stream in the scratch buffer. Syntax PARSE [ [ invalid label ] [ , valid label ] ] Process The PARSE command invokes the printer's MPCL parser to analyze and process the scratch buffer's contents. In general, the PARSE command will out perform (speed to label out) the PRINT command. If you have the option of using either command (PARSE or PRINT), PARSE is the better option. NOTE: You must place an MPCL data stream in the scratch buffer before calling this command.
PRINT Purpose Prints the Printer Buffer's contents, by a source field, in the format specified. Syntax PRINT [ CONTINUOUS ] # format-number, [ quantity ] [ , [ invalid label ] [ , valid label ] ] Process The PRINT command images and prints the format specified by format-number . Format-number contains a format number between 0 and 999. Numbers greater than 255 cannot be constants. If format-number equals 0, the same image prints. Use this method to avoid reimaging the data.
QUERY Purpose Searches the lookup file to find a specified record. Syntax QUERY buffer-field1 , comparison , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The QUERY command searches the lookup file to find a record containing a specific value. NOTE: If multiple records contain the value, the command reads the first record fitting the criteria.
Rule: Buffer-field1 and buffer-field2 must be the same type. For example, if buffer-field1 is numeric, buffer-field2 must be numeric. If the record is not found, the pointer is undefined. The script must execute the command again to ensure a valid record pointer. Optional Fields Invalid and valid labels are discussed in "Script Flow" at the beginning of this chapter. The exception is as follows: If the search fails to find the requested field or it detects end of file, control passes to invalid label .
READ Purpose Copies the current record from the lookup file into the appropriate working buffer. Syntax READ record [ ( table-name ) ] [ , [ invalid label ] [ , valid label ] ] Process The READ command copies the current record into the appropriate working buffer, specified by record . After the script copies the current record into the buffer, the pointer advances to the next record in the file. Table-name selects which lookup table to read.
RESTORESCREEN Purpose Re-displays a previously-saved screen. Syntax RESTORESCREEN Process The RESTORESCREEN command restores the contents of a previously saved screen to the screen, overwriting the current screen’s contents. The SAVESCREEN command saved the original screen and stored it in the internal screen buffer. Example This example restores contents of the original screen (containing “1234567890”) to the screen, overwriting the screen’s current contents.
RETURN Purpose Breaks out of a subroutine. Syntax RETURN Process The RETURN command breaks out of a subroutine. It transfers control back to the command following the CALL activating the subroutine. NOTE: Example Using END in a subroutine also implies a RETURN. Therefore, the RETURN command is not required as the last command of a subroutine. This example breaks out of a subroutine.
RIGHT Purpose Extracts the right-most characters from a string. Syntax RIGHT buffer-field1 , buffer-field2 , length [ , [ invalid label ] [ , valid label ] ] Process The RIGHT command extracts the right-most characters from buffer-field1 , specified by length , and copies them into buffer-field2 .
RSTRIP Purpose Strips characters from a field, and copies the remaining characters to another field. Syntax RSTRIP buffer-field1, buffer-field2, length [ , [ invalid label ] [ , valid label ] ] Process The RSTRIP command strips the right-most characters from buffer-field1 and copies the remaining characters to buffer-field2 . Length is the number of characters to strip.
SAVESCREEN Purpose Saves the contents of the current screen. Syntax SAVESCREEN Process The SAVESCREEN command moves the contents of the current screen to the internal screen buffer. The RESTORESCREEN command re-displays the saved screen. NOTE: Example The internal screen buffer is cleared (and therefore the screen is lost) when the READY prompt appears, you calibrate the printer, or the application ends. This example displays “1234567890” on the screen and saves it.
SEEK Purpose Positions the record pointer within the lookup table. Syntax SEEK modifier , file-type [ ( table-name ) ] [ , [ invalid label ] [ , valid label ] ] Process The SEEK command positions the record pointer within the lookup table, according to modifier .
SUB Purpose Subtracts the contents of one field from the contents of another. Syntax SUB buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The SUB command subtracts the contents of buffer-field1 from the contents of buffer-field2 , inserting the result into buffer-field2 .
SWITCH Purpose Directs script flow by branching to a set of commands based on the value of a variable. Syntax SWITCH buffer-field1 CASE buffer-field . . . CASE buffer-field . . . DEFAULT . . . ENDSWITCH Process The SWITCH command directs script flow by branching to a set of commands based on the value of a variable. The command compares buffer-field1 to the buffer-field listed with each case command. If the fields are equal, the script executes the commands following the CASE command.
Example This example compares the Input Buffer's contents to <<, >>, and =. For example, if the input contains >>, the script executes the commands following CASE ">>" until the next CASE or DEFAULT command. Control then passes to ENDSWITCH. If the input buffer does not match any values, the script executes the commands following DEFAULT, until it reaches ENDSWITCH.
SYSSET Purpose Sets the printer’s default parameters. Syntax SYSSET function , parameter1 , parameter2 Process The SYSSET command sets the function parameter with the parameter1 value, and if applicable, the parameter2 value. If parameter1 and parameter2 are both buffer fields, they must be numeric. If they are a constant, precede it with a number sign (#) except where noted.
Example Function/Description Parameter1 Parameter2 SHUTDOWN Enables or disables this parameter. If enabled, sets the number of seconds without activity before the printer turns off automatically. 0 (Disabled) 1 (Enabled) 2-480 (Timeout) n/a LABEL The label’s dimensions in dots. Width 208 (1.2”) or use this formula: 192 * width in inches 33 Length 89 (.55”) or use this formula: 192 * length in inches - 32 REVVID Enables or disables reverse video on the screen.
TOKEN Purpose Sets a token delimiter or extracts a token-delimited sub-field from a larger field. Syntax To set a token delimiter: TOKEN DELIMETER character [ , [ invalid label ] [ , valid label ] ] To extract a sub-field: TOKEN buffer-field1 , buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The TOKEN command sets character as the token delimiter or extracts a sub-field from buffer-field1 (delimited by character ) and places it in buffer-field2 .
TSTRIP Purpose Strips characters from a field based on a template. Syntax TSTRIP buffer-field1, buffer-field2 [ , [ invalid label ] [ , valid label ] ] Process The TSTRIP command strips data from buffer-field1 as specified by buffer-field2 . Buffer-field2 contains a template that has a series of numbers and underscore characters (_). The printer matches the buffer-field1 with the template, resulting in new data, as follows: ♦ If the characters in the same position match, they are stripped.
UPPER Purpose Converts the specified field to upper-case characters. Syntax UPPER source Process The UPPER command converts source to upper-case characters.
VALIDATE Purpose Validates a check digit based on check digit scheme. Syntax VALIDATE source, type [ , [ invalid label ] [ , valid label ] ] Process The VALIDATE command validates the check digit in source , based on the check digit scheme specified by type .
WHILE Purpose Repeats a sequence of commands as long as a condition is true. Syntax WHILE buffer-field1 comparison buffer-field2 . . . ENDWHILE Process The WHILE command repeats a sequence of commands as long as a condition is true. If the condition is true, the script executes the commands listed between WHILE and ENDWHILE. When script reaches ENDWHILE, it checks the condition again. If the condition still exists, it executes the commands again.
Example This example calls the macro PTRIDLE that checks for the printer status. The WHILE loops executes until the printer is ready to accept more data.
5-88 Command Reference
A SAMPLE SCRIPT This chapter provides a sample script for retail printing. Depending on the character entered by the user, a different format prints. One is a compliance format, another is a receiving format, and the other is a sale format. Use this script as a guide when you program the printer. See Chapter 4, “Program Structure” for additional programming tips. ;Script File ;Sample Script ;Author: A.Kramer ;Date: Sept.
;The Comply function contains the batch data for the compliance format.
;The SendFmt function moves the three formats into the scratch buffer. ;The batch data is sent when the user sends a “C,” “R,” or “S” character.
CONCAT CONCAT CONCAT CONCAT CONCAT CONCAT CONCAT CONcaT CONCAT CONCAT CONCAT CONCAT CONCAT parse return "C,166,238,0,50,9,9,A,L,0,0,~034QTY 48~034|", SCRATCH "C,75,107,0,510,1,1,B,L,0,0,~034744148022201~034|", SCRATCH "C,52,132,0,50,8,8,A,L,0,0,~03402/22/01 15:29~034,1|", SCRATCH "T,2,20,V,29,123,0,50,8,8,A,L,0,0,1|}", SCRATCH "{F,3,A,R,E,300,200,~034Sale~034|", SCRATCH "B,1,13,F,99,52,7,2,40,7,L,0|", SCRATCH "C,279,28,0,510,1,1,B,L,0,0,~034063 DEPT#25~034|", SCRATCH "T,2,15,V,243,61,0,50,10,10,A,L,0,0,1|"
INDEX A commands data manipulation, 5-6 accessing the toolbox, 3-1 file management, 5-7 add command, 5-8 input/output, 5-7 applications, loading, 3-2 math, 5-5 appversion command, 5-9 script control, 5-5 argread command, 5-10 comments in a script, 4-4 arrays, 4-3 compare command, 5-28 asc command, 5-11 compiler directives, 5-5 autostart command, 5-12 concat command, 5-29 availabledata command, 5-13 B connecting the printer, 2-1 conventions for programming, 5-1 cstrip command, 5-30 bitcl
F L fetch command, 5-40 labelcount command, 5-52 field names, 5-1 left command, 5-53 field names, scope of, 5-3 linkfile command, 5-54 fieldlen command, 5-41 loading applications, 3-2 file management commands, 5-7 locate command, 5-55 files, 4-2 lookup buffers, 4-2 files, saving, 2-4 lower command, 5-56 fixdata command, 5-42 lstrip command, 5-57 flow control of scripts, 4-3 M flow of scripts, 5-4 functional relationships, 5-5 macro command, 5-58 manual, using, 1-1 functions, 4-1 math
seek command, 5-76 projects software building, 2-5 downloading, 2-7 installation, 2-1 editing existing, 2-7 using, 2-1 special characters, 4 introduction, 2-4 Q query command, 5-68 starting scripts, 4-2 storage of data, 4-4 structure of programs, 4-1 R sub command, 5-77 switch command, 5-78 read command, 5-70 ready prompt, displaying, 3-1 reference for commands, 5-1 sysset command, 5-80 system requirements, 2-1 T relationships, functional, 5 requirements, system, 2-1 temporary storage buffer
4 Index