home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
comm
/
pwhostb.zip
/
REDIR.WAS
< prev
next >
Wrap
Text File
|
1993-06-11
|
7KB
|
135 lines
;REDIR.WAS - Dos Shell Utility 1.00
;*****************************************************************************
;* *
;* REDIR.WAS *
;* Copyright (C) 1992 Datastorm Technologies, Inc. *
;* All rights reserved. *
;* *
;* This script is a demonstration of how to add in the ability to shell to *
;* DOS in either the Host.was script or any other script the user desires. *
;* This script can be executed from any other script and allows the remote *
;* user to redirect DOS output to the COM port currently being used by *
;* Procomm Plus. Since COMMAND.COM is redirecting the DOS output to the *
;* COM port, only those commands and programs which use the host machine's *
;* BIOS to write to the screen can be redirected to the remote system. *
;* *
;* This ASPECT SCRIPT is intended as a sample of ASPECT programming. *
;* DATASTORM makes no warranty of any kind, express or implied, including *
;* without limitation, any warranties of merchantability and/or fitness *
;* for a particular purpose. Use of this program is at your own risk. *
;* *
;* Author: Kevin Bailey *
;* Modified by: Jeff Schmidt *
;*****************************************************************************
;*****************************************************************************
;* GLOBAL VARIABLES *
;*****************************************************************************
long bdrate ; Baud Rate of Current Connection
string cport ; COM Port Being Used
string pparity ; Text Parity Setting
string textline="" ; Text to write to file
string filepath ; Aspect File Path
string FileUsed ; File Path Being Used
string errmsg ; Error Message for Remote User
integer dbits ; Databits
integer stbits ; Stop Bits
integer parnum ; Numeric Parity Setting
;*****************************************************************************
;* *
;* MAIN *
;* The main procedure is the only procedure used in this script. It will *
;* create a dos .BAT file which will load COMMAND.COM and redirect it to *
;* the current COM port. It will not allow loading of COMMAND.COM if there *
;* is no CARRIER detect on the COM port. *
;* *
;* Calls: N/A *
;* Modifies Globals: bdrate,cport,pparity,textline,errmsg,dbits,stbits *
;* parnum *
;*****************************************************************************
proc main
statmsg ""
fetch connection port cport ; Save the current COM port
fetch baudrate bdrate ; Save the current baud rate
fetch aspect scriptpath filepath ; Save Aspect Path
if $carrier ; Make sure we have a CARRIER
assign fileused filepath
addfilename fileused "redir.bat" ; Create Path For File
fopen 0 fileused CREATE TEXT ; Open BAT file
if success ; If file open successful
fetch port databits dbits ; Save current data bits
fetch port stopbits stbits ; Save current stop bits
fetch port parity parnum ; Save Current parity
switch parnum ; Make the text parity setting
case 0
assign pparity "n"
endcase
case 1
assign pparity "o"
endcase
case 2
assign pparity "e"
endcase
case 3
assign pparity "m"
endcase
case 4
assign pparity "s"
endcase
endswitch
; Make the Mode batch line
strfmt textline "modex %s: %ld %s %d %d" cport bdrate pparity dbits stbits
fputs 0 textline
; Make the Copy Header line
strfmt textline "copy header.txt %s" cport
fputs 0 textline
strfmt textline "command %s" cport ; Make the COMMAND.COM line
fputs 0 textline
fclose 0 ; Close the .BAT file
pause 2
assign fileused filepath
addfilename fileused "redir.pif" ; Create PIF File Path
run fileused MINIMIZED i0 ; Run the .BAT file (was run)
if success ; Notify SYSOP
statmsg "Shelled to Dos on: %s" cport
while istask i0 ; Loop until .BAT is finished
endwhile
assign errmsg "" ; No error occurred
else ; .BAT file did not execute
assign errmsg "Error Shelling to DOS^M^J"
endif
pause 2
set baudrate bdrate ; Reset baud rate
transmit errmsg ; Send error message
else ; Not able to Shell error
transmit "Sorry, Unable to Shell to DOS at This Time^M^J"
transmit "Please notify the SysOp!^M^J"
statmsg "ERROR: Unable to Create .BAT Shell File."
endif
else ; No CARRIER
transmit "Sorry, Unable to Shell to DOS at This Time^M^J"
transmit "CD Not Asserted on Local Port.^M^J"
statmsg "ERROR: DOS Shell Aborted (CD Not Asserted on %s)" cport
endif
endproc