home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
haotd1_1.zip
/
PCWEXP.WAS
< prev
next >
Wrap
Text File
|
1995-10-12
|
7KB
|
313 lines
; *
; * $Revision: 1.1 $
; * $Date: 1995/07/19 11:25:56 $
; *
; Global variables defined.
;
string sPcPlusDir, sProgress1, sExportName, sFullName, sTemp
integer itemp
;/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; * FUNCTION:
; * main
; *
; * DESCRIPTION:
; * This routine calls a few functions to obtain file names, then
; * writes out a simple ascii file that can be used with Hilgraeve's
; * convert program. The convert program reads the ascii file produced
; * by this script and create HA\Win session files.
; *
; * ARGUMENTS:
; *
; * RETURNS:
; *
; */
proc main
integer index, nDataBits, nParity, nStopBits, nLocalEcho, nFileIndex
string sName, sNumber, sEmulation, sPCEmu
long lRate
string LineOut
SelectDirectoryFile()
if strcmp sPcPlusDir $NULLSTR
Exit
endif
if not $DIALCOUNT > 0
errormsg "There are no entries in this dialing directory"
Exit
endif
GetExportFileName()
; Open the export file
;
nFileIndex = 0
fopen nFileIndex sExportName CREATE TEXT
if not success
strfmt sName "Can't create %s" sExportName
errormsg sName
Exit
endif
; Display a dialog box to show conversion progress.
;
sProgress1 = $NULLSTR
dialogbox 26 19 200 50 15 "Progress!"
vtext 10 10 197 27 left sProgress1
enddialog
for index = 1 upto $DIALCOUNT
set dialdir access index
sName = $D_NAME
sNumber = $D_NUMBER
;fetch terminal type sEmulation
fetch baudrate lRate
fetch port databits nDataBits
fetch port parity nParity
fetch port stopbits nStopBits
fetch port duplex nLocalEcho
; Procomm bug reports 655350 when baud rate == 115200
;
if lRate > 115200
lRate = 115200
endif
; Determine emulation
;
fetch terminal type sPCEmu
switch sPCEmu
case "ADDS 60"
case "ADDS 90"
sEmulation = "Viewpoint"
endcase
case "ADM 31"
case "ADM 3a"
case "ADM 5"
sEmulation = "ADM3A"
endcase
case "ANSI BBS"
case "IBM PC"
sEmulation = "ANSI"
endcase
case "IBM 3101"
case "IBM 3161"
sEmulation = "IBM 3101"
endcase
case "IBM 3270"
sEmulation = "IBM 3270"
endcase
case "TTY"
sEmulation = "TTY"
endcase
case "TVI 910"
case "TVI 912"
case "TVI 920"
case "TVI 922"
case "TVI 925"
sEmulation = "TV925"
endcase
case "TVI 950"
case "TVI 955"
sEmulation = "TV950"
endcase
case "VT-52"
sEmulation = "VT52"
endcase
case "VT-100"
sEmulation = "VT100"
endcase
case "VT-102"
sEmulation = "VT102"
endcase
case "VT-220"
sEmulation = "VT220"
endcase
case "VT-320"
sEmulation = "VT320"
endcase
case "VIDEX"
sEmulation = "CompuServe"
endcase
default
sEmulation = "TTY"
endcase
endswitch
; Remove any commas from the string variables. This is the field
; delimiter.
;
strreplace sName "^" "-"
strreplace sNumber "^" "-"
strreplace sEmulation "^" "-"
strfmt LineOut "%s^%s^%s^%ld^%d^%d^%d^%d" \
sName sNumber sEmulation lRate nDataBits \
nParity nStopBits, nLocalEcho
fputs nFileIndex Lineout
strfmt sProgress1 "Converting entry %d of %d" index, $DIALCOUNT
updatedlg 64
endfor
destroydlg
; Close the export file.
;
fclose nFileIndex
fullpath sExportName, sFullName
; Tell the user what has happened.
;
;strfmt LineOut, "Conversion of %s complete. %d entries have been exported to the file named %s" \
; sPcPlusDir, $DIALCOUNT, sFullName
strfmt LineOut, \
"Conversion of %s complete. %d entries have been exported to the file named %s. \
You may now run Hilgraeve's Conversion program using this export file." \
sPcPlusDir, $DIALCOUNT, sFullName
usermsg LineOut
Exit
endproc
;/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; * FUNCTION:
; * SelectDirectoryFile
; *
; * DESCRIPTION:
; * This routine allows the user to select the Procomm for Windows
; * dialing directory that is to be converted.
; *
; * ARGUMENTS:
; *
; * RETURNS:
; *
; */
proc SelectDirectoryFile
string sTestName
long lFileSIze
dialogbox 26 19 200 90 15 "Enter file"
text 10 10 197 27 left "This program converts a Procomm Plus for Windows"
text 10 17 197 27 left "dialing directory into an export file for use with"
text 10 24 197 27 left "Hilgraeve's Convert program."
text 10 38 197 27 left "Dialing directory to be converted:"
editbox 10 48 130 12 sPcPlusDir
pushbutton 10 68 40 14 "OK" NORMAL
pushbutton 60 68 40 14 "Cancel" CANCEL
pushbutton 150 48 40 14 "Browse" NORMAL
enddialog
itemp = $dialog
while 1
if itemp == 10 ; OK pressed!
; Validate the name by checking to see if the extension
; is at least ".dir"
;
sTestName = sPcPlusDir
strright sTestName sPcPlusDir 4
strlwr sTestName
if not strcmp sTestname ".dir"
errormsg "Invalid file name. Please try again."
else
; Now name sure the file exists.
;
getfsize sPcPlusDir lFileSize
if not success
errormsg "Invalid file name. Please try again."
else
dialload sPcPlusDir
endif
exitwhile
endif
endif
if itemp == 1 ; Cancel pressed!
exitwhile
endif
if itemp == 11 ; Browse
dir "*.dir" sPcPlusDir
updatedlg 128
endif
itemp = $dialog
endwhile
destroydlg
endproc
;/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
; * FUNCTION:
; *
; * DESCRIPTION:
; *
; * ARGUMENTS:
; *
; * RETURNS:
; *
; */
proc GetExportFileName
long lFileSize
string sName
; Fully quallify the name and see if it exists. If it does,
; ask the user if it's OK to overwrite the file. If OK, continue,
; otherwise exit the script.
;
sName = "tohaos2.exp"
fullpath sName sExportName
getfsize sExportName lFileSize
if success
strfmt sTemp "The file %s already exists." sExportName
dialogbox 26 19 200 70 15 "File Exists!"
vtext 10 10 197 27 left sTemp
text 10 24 197 27 left "The file will be overwritten!"
pushbutton 10 40 40 14 "OK" NORMAL
pushbutton 60 40 40 14 "Cancel" CANCEL
enddialog
itemp = $dialog
while 1
if itemp == 10 ; OK pressed!
exitwhile
endif
if itemp == 1 ; Cancel pressed!
destroydlg
Exit
endif
itemp = $dialog
endwhile
destroydlg
endif
endproc