Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-90 Programming Guide
To Use Macros (QuickBASIC) (Continued)
purgemacro: 'Purge all macros
INPUT "Are you sure you want to purge all macros? ", answer$
answer$ = UCASE$(answer$)
IF answer$ = "Y" THEN
sendhp ("*PMC")
PRINT "All macros purged"
END IF
RETURN
disablemacro: 'Disable macros, but do not purge
sendhp ("*EMC 0")
PRINT ("Macros Disabled")
RETURN
sendmacro:
CLS
GOSUB displaymacro
INPUT "Enter the name of the macro to send ", namemacro$
IF namemacro$ = "" THEN RETURN
sendhp (namemacro$)
RETURN
definemacro: 'Define a macro
CLS
INPUT "Enter the name of the macro to be defined ", namemacro$
INPUT "Enter the commands to be sent ", commandmacro$
length = LEN(commandmacro$)
numchar = INT(LOG(length) / LOG(10#)) + 1
header$ = "#" + LTRIM$(STR$(numchar))
PRINT header$
macrocommand$ = header$ + LTRIM$(STR$(length)) + commandmacro$
code$ = "*DMC " + CHR$(39) + namemacro$ + CHR$(39) + "," + macrocommand$
PRINT code$
CALL iooutputs(source, code$, LEN(code$))
RETURN
quit:
PRINT "End of Program"
STOP
RETURN
SUB sendhp (code$)
CALL iooutputs(source, code$, LEN(code$))
END SUB