Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
;ver-03SEP2007, Script written by Chris Jackson.
;########################################################################################################
;# script problems- mailto: commtech@aapt.net.au #
;# #
;# This script will go to LD97,PRT,XPE then LD32 ->IDCS##->Then STAT ALL Dig & A'log Cards in PABX... #
;# #
;########################################################################################################
;the LD97,PRT,XPE resolves the IDCS - Superloop Nos okay.
string FTemp ; Name of temp file to save to.
string FName ; Name of capture file to open.
string FSwap ; Name of swap file for temp use.
string FPath ; Path of capture file.
string IDCSNo ; IDCSNo
string SLoopNo ; SLoopNo
string ShelfNo = "0" ; ShelfNo
string CardNo ; CardNo
string LineInfo ; String for reading from files line by line
string TempStr ; A Temporary String
string LineStr ; Another Temp String
string TmpStrBB ; Yet another Temp String
integer Choice
PROC MAIN
set txpace 40
FName = "tempfile.txt" ; Name of capture file to open.
FPath = "C:\Program Files\Symantec\Procomm Plus\Capture\"
;CHECK IF USER WANTS THIS
while Choice <= 5 ; Loop while user doesn't choose.
sdlgmsgbox "CAUTION - !" "LD97,PRT,XPE->LD32,IDCS##->Then STAT ALL Dig & A'log Cards in PABX... Proceed?" QUESTION YESNO Choice 2
yield
endwhile
if Choice == 7 ; See if user said no.
call term
endif
;end check
;logout of any LD's
transmit "****^M"
waitfor ">" FOREVER
;Run LD97
transmit "LD 97^M"
waitfor "REQ" FOREVER
;capture screen display to file
set capture file FName ; Set name of capture file.
set capture overwrite ON
capture on ; Open up the capture file.
pause 1
transmit "PRT^M"
waitfor "TYPE"
transmit "XPE^M"
waitfor "XPEC"
clear ;clear screen
transmit "^M"
;this is a bugfix for my pabx
waitfor " 30 " 5
if failure
transmit "^M"
pause 2
endif
;endbugfix
pause 2
capture off ;Close the capture file
call readidcs
call idcsld32
call reworkit
call statcard
pause 1
run FTemp
CAPTURE OFF
SET CAPTURE FILE NONE
ENDPROC
PROC READIDCS
;playback from capture file
FName = "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
FTemp = "C:\Program Files\Symantec\Procomm Plus\Capture\deleteme.txt"
fopen 1 FTemp CREATE TEXT
if isfile FName ; Make sure file exists.
if fopen 0 FName READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if rstrcmp LineInfo " " 1 ;1st char is a space
strextract IDCSNo LineInfo " " 1
strextract SLoopNo LineInfo " " 2
if strcspn IDCSNo "1234567890" ;its a number
strcat IDCSNo ","
strcat IDCSNo SLoopNo
fputs 1 IDCSNo
endif
endif
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
endif
else
errormsg "File doesn't exist."
call term
endif
ENDPROC
PROC IDCSLD32
transmit "****^M"
waitfor ">"
transmit "LD 32^M"
waitfor "."
FTemp = "C:\Program Files\Symantec\Procomm Plus\Capture\deleteme.txt"
FName = "tempfile.txt" ; Name of capture file to open.
;capture screen display to file
set capture file FName ; Set name of capture file.
set capture overwrite ON
capture on ; Open up the capture file.
pause 1
if isfile FTemp ; Make sure file exists.
if fopen 0 FTemp READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if strfind LineInfo ","
strextract IDCSNo LineInfo "," 0
TempStr = "IDCS "
strcat TempStr IDCSNo
strcat TempStr "^M"
transmit TempStr
waitquiet 2 FOREVER
endif
endwhile
fclose 0 ; Close the file.
endif
else
errormsg "File doesn't exist."
call term
endif
capture off
pause 1
;read back from capture file and save to swapfile
FSwap = "C:\Program Files\Symantec\Procomm Plus\Capture\swapfile.txt"
FName = "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
fopen 1 FSwap CREATE TEXT
if isfile FName ; Make sure file exists.
if fopen 0 FName READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if rstrcmp LineInfo ".IDCS" 5 ;its the IDCS info
fputs 1 LineInfo
endif
;check for Analogue Cards
if strfind LineInfo "NT5K02" ;flex analogue
fputs 1 LineInfo
endif
if strfind LineInfo "NT8D03" ;analogue
fputs 1 LineInfo
endif
if strfind LineInfo "NT8D09" ;analogue message
fputs 1 LineInfo
endif
;check for Digitals
if strfind LineInfo "NT8D02" ;Digital
fputs 1 LineInfo
endif
if strfind LineInfo "NTDK16" ;Digital
fputs 1 LineInfo
endif
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
endif
else
errormsg "File doesn't exist."
call term
endif
ENDPROC
PROC REWORKIT
;THIS PROCEDURE IS COCKED UP....swapfile is ok, tempfile it creates is not.
;read back from swapfile and save to deleteme
FSwap = "C:\Program Files\Symantec\Procomm Plus\Capture\swapfile.txt"
FName = "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
fopen 2 FName CREATE TEXT
if isfile FSwap ; Make sure file exists.
if fopen 0 FSwap READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if strfind LineInfo ".IDCS" ;its the IDCS info
substr TempStr LineInfo 6 2
;search through file
fopen 1 FTemp READ
while not feof 1 ; Loop to end of file.
fgets 1 TmpStrBB ; Get line from file.
if rstrcmp TmpStrBB TempStr 2 ;it is our info
LineStr = TmpStrBB
;format string for string extraction from file
strreplace LineStr "," " => "
strcat LineStr " => "
endif
endwhile
endif
if rstrcmp LineInfo "CARD" 4
TempStr = LineStr
strreplace LineInfo "CARD " "" ;delete CARD
strcat TempStr LineInfo
strreplace TempStr "`n" "" ;strip line feed string
strreplace TempStr "`r" "" ;strip line feed string
fputs 2 TempStr
endif
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
fclose 2 ; Close the file.
endif
else
errormsg "File doesn't exist."
call term
endif
ENDPROC
PROC STATCARD
FTemp = "deleteme.txt" ; Name of capture file to open.
FName = "C:\Program Files\Symantec\Procomm Plus\Capture\tempfile.txt"
;capture screen display to file
set capture file FTemp ; Set name of capture file.
set capture overwrite ON
capture on ; Open up the capture file.
pause 1
fopen 0 FName READ
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
strextract SLoopNo LineInfo " => " 1
strextract CardNo LineInfo " => " 2
TempStr = "STAT "
strcat TempStr SLoopNo
strcat TempStr " "
strcat TempStr ShelfNo
strcat TempStr " "
strcat TempStr CardNo
strcat TempStr "^M"
transmit TempStr
waitquiet 1 FOREVER
endwhile
fclose 0 ; Close the file.
capture off
pause 1
;filter the capture file...
FTemp = "C:\Program Files\Symantec\Procomm Plus\Capture\deleteme.txt"
FSwap = "C:\Program Files\Symantec\Procomm Plus\Capture\swapfile.txt"
pause 2
fopen 0 FTemp READ
fopen 1 FSwap CREATE TEXT
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if strfind LineInfo ".STAT"
fputs 1 LineInfo
endif
if NOT strfind LineInfo "= BUSY"
if NOT strfind LineInfo ".STAT"
if NOT strfind LineInfo "DSBL"
if NOT strfind LineInfo "IDLE"
if NOT rstrcmp LineInfo "2" 1 ;1st char is digit 2
if NOT rstrcmp LineInfo "3" 1 ;1st char is digit 3
if NOT rstrcmp LineInfo "17" 2 ;1st 2 chars are 17
if NOT rstrcmp LineInfo "18" 2 ;1st 2 chars are 18
if NOT rstrcmp LineInfo "19" 2 ;1st 2 chars are 19
strreplace TempStr "`n" "" ;strip line feed string
strreplace TempStr "`r" "" ;strip line feed string
fputs 1 LineInfo
endif
endif
endif
endif
endif
endif
endif
endif
endif
endwhile
fclose 0 ; Close the file.
fclose 1 ; Close the file.
pause 2
;open swap file and resort the contents into spreadsheet form...
;set FTemp to be date dependant
FTemp = "C:\Program Files\Symantec\Procomm Plus\Capture\"
strcat FTemp "UNEQ_TNs_"
TempStr = $DATE
strreplace TempStr "/" "-"
strcat FTemp TempStr
strcat FTemp ".csv"
fopen 0 FSwap READ
fopen 1 FTemp CREATE TEXT
LineStr = "" ;wipe previous values
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo ; Get line from file.
if strfind LineInfo ".STAT"
strreplace LineStr "`n" "" ;strip line feed string
strreplace LineStr "`r" "" ;strip line feed string
strcat LineStr ","
strcat LineStr TempStr
;remove last semi colon
strrev LineStr
if rstrcmp LineStr ";" 1 ;1st char is a semi-colon
strdelete LineStr 0 1
endif
strrev LineStr
;end remove semi colon
;check LineStr contents
if NOT strfind LineStr "STAT"
fputs 1 LineStr
endif
TempStr = "" ;wipe string
LineStr = LineInfo
strreplace LineStr ".STAT " "" ;strip stat to leave L S C
endif
if strfind LineInfo "UNEQ"
strextract TmpStrBB LineInfo " = " 1
strreplace TmpStrBB "UNIT" "" ;strip UNIT from string
strcat TempStr TmpStrBB
strcat TempStr ";"
endif
endwhile
pause 2
fclose 0 ; Close the file.
fclose 1 ; Close the file.
ENDPROC
PROC TERM
transmit "****^M"
CAPTURE OFF
SET CAPTURE FILE NONE
exit ;end script
ENDPROC