(view source code of getports.rex as plain text)
/* Check command line arguments (none required) */
Parse Arg strArgs
If strArgs <> "" Then Call Syntax
/* Initialize RexxUtil library */
If RxFuncAdd( 'sysloadfuncs', 'RexxUtil', 'sysloadfuncs' ) = 0 Then Do
Call sysloadfuncs
End
Else Do
Call Syntax "Unable to initialize RexxUtil"
End
/* Hide interpreter's screen output */
"@ECHO OFF"
Trace Off
/* Temporary DEBUG script: */
/* Use name of this Rexx script . . . */
Parse Source . . me
/* Replace extension of this script with ".DBG" */
Parse Value Reverse( me ) with ext"."em
filDbgIn = Reverse( em )||".dbg"
/* Define content of temporary DEBUG script */
strDbgIn = "D 40:0 L E"||"0D0A"X||"Q"||"0D0A"X
/* Write content to temporary DEBUG script */
Call CharOut filDbgIn, strDbgIn
/* Close temporary DEBUG script */
Call LineOut filDbgIn
/* Use temporary DEBUG script to retrieve */
/* information on parallel and serial ports */
'DEBUG < "'||filDbgIn||'" | FIND "40:0" | FIND /V "-D " | RXQUEUE'
Do Until Queued( ) = 0
Pull strDbgOut
End
/* Delete temporary DEBUG script */
'DEL "'||filDbgIn||'" 2>NUL'
/* Parse the information we got from DEBUG */
Parse Value strDbgOut With ." "strComPorts"-"strLptPorts" ".
Parse Value strComPorts With com1b com1a com2b com2a com3b com3a com4b com4a
Parse Value strLptPorts With lpt1b lpt1a lpt2b lpt2a lpt3b lpt3a
/* Display the results */
Say
Say "COM1="||com1a||com1b
Say "COM2="||com2a||com2b
Say "COM3="||com3a||com3b
Say "COM4="||com4a||com4b
Say "LPT1="||lpt1a||lpt1b
Say "LPT2="||lpt2a||lpt2b
Say "LPT3="||lpt3a||lpt3b
/* Normal program termination */
Exit 0
Syntax:
Parse Arg strErrMsg
If strErrMsg <> "" Then Say "0D0A"X||strErrMsg||"0D0A"X
Say
Say "GetPorts.rex, Version 1.00"
Say "Display addresses of all serial and parallel ports"
Say
Say "Usage: <REXX> GETPORTS.REX"
Say
Say 'Where: "<REXX>" is your Rexx interpreter:'
Say " - Windows: REGINA.EXE with RexxUtil installed"
Say " - OS/2: no need to specify, just rename script to *.cmd"
Say
Say "This script uses DEBUG.EXE to retrieve the required information."
Say "A temporary DEBUG script needs to be created in the directory where this Rexx"
Say "script is located."
Say
Say "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 1
Return
page last modified: 2024-04-16; loaded in 0.0064 seconds