Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for simple script to modify the Hunt DN of large number of phones from a file

Status
Not open for further replies.

Scooter2368

Technical User
Sep 19, 2012
4
US
About 20 years ago I had some simple looping aspect scripts that would pull data from a text file. It would count the number of characters per line and pull the next certain number of characters then "enter" 9or send) that text. I know you can do it directly from an excell spreadsheet and I can go either way.

What I need is a way to record then modify the "loop" to pull data from a file.

Any example out there. Nothing fancy.
 
Figured it out thanks to knob and his collection of samples. Good work.
 
knob,
Here is the one I created and it works but... I need to now create one from a text file since I need to run in on a server that doesn't have Excel. Attached is the one I created and the old one from years ago but it won't compile.

Thought on how to "transmit data from a text file list? This old one used to go down a list within a text file. sorry for pasting it. Can't attach.

I just need the part that opens a text file and extracts specific "column" of text.

Thoughts?

;changes all Durham triwide nxx's to entered RLI
string rli
integer eof
string nxxbuffer
string twdnxx

proc main

dialogbox 0 32 44 196 83 66 "Caption"
editbox 1 77 41 32 12 rli
text 3 36 10 121 8 "Enter the RLI for Durham triwide NXXs:" center
text 2 60 28 70 8 "Durham ONLY !!!!" center
pushbutton 4 42 62 40 14 "OK" ok default
pushbutton 5 105 62 40 14 "Cancel" cancel
enddialog

transmit "^M"
waitfor "REQ "
transmit "CHG^M"
waitfor "CUST "
transmit "0^M"
waitfor "FEAT "
transmit "NET^M"
waitfor "TRAN"
transmit "AC2^M"
waitfor "TYPE "
transmit "NXX^M"
waitfor "NXX "
pause 1

fopen 0 "c:\prowin2\aspect\ksrdrtwd.txt" read ;open text file
fgets 0 nxxbuffer ;put file into string called nxxbuffer
while !eof ;while not at end of file
substr twdnxx nxxbuffer 0 3 ;take first nine char. put in stng
transmit twdnxx
transmit "^M"
waitfor "RLI "
transmit rli
pause 1
transmit "^M"
waitfor "SDRR "
transmit "^M"
waitfor "ITEI "
transmit "^M"
waitfor "NXX "
fgets 0 nxxbuffer
feof 0 eof
endwhile
fclose 0
transmit "^M"
endproc


 
Sorry but this is the one that Doesn't work. Just trying to be clear.
 
hello scooter
you can try F.B. script for change




____________________________________________________________
===============================================



; Easy Change Dig Sets.was 5th June 2009

; NOTE!
; This program will ONLY work with a Windows version of PROCOMM PLUS!.
; This Procomm Script file is for you to do a "CHG" list of Digital Extn sets
; The " ; " denotes that the data on this program script is ignored when the
; file is run.
; You must make sure that you have the "vkeys.inc" file located within
; Procomm Plus "Aspect" folder!. The script file will not compile without it!.
; If you don't have this file, then go to the last part of this script file &
; copy that section without the ";" as the file "vkeys.inc".

; The script will also record for you a LOG file such as "pw01.cap" etc.
; The program will use LD 11 for all the changes.
; Follow the instructions by Ticking the box's on the screen & locating your
; source file.
; It's best to leave the "Set Type" Box with "File" alone if you have the
; Extn's "TYPE" in your source file.
; Useful point to remember is that this script file will also use the Analogue
; "TYPE" 500 Extn's when your Meridian has V19.xx or later software!.
; However you cannot MIX the "FEATURE" & "KEY" functions!.

; Against "Item" on the Left hand side, put in whatever you require such as..

; NCOS 6 (First Line)
; CLS CFXA DPUA GPUA LNA (Second Line)
; RNPG 2 (Third Line etc & so on!)

; Against "Key" on the Right hand side, put in whatever you require such as..

; 1 CFW 16 (First Line) "1" = KEY 1
; 3 SSU 10 (Second Line) "3" = KEY 3
; 4 ADL 16 9003898989 (Third Line etc & so on!)

; Do all this until you have finished.

; You might need to change the "Transmit Pacing" depending on the software version!
; A higher number is needed to slow the program down for older processors.
; Make sure that you click on "ACCEPT" to run in your entries.

; The SOURCE file should be in a *.CSV Format (EXCEL!)
; An example of the source file as viewed in text, is shown below.
; It should be The "TN" Number followed by the "TYPE"

; 004 0 00 00,2616
; 004 0 00 01,2216
; 004 0 00 02,2008
; 004 0 00 03,I2004
; 004 0 00 04,3905V
; 004 0 00 05,3901

; This program file should remain unaltered & only copies made from it for whatever
; use is required. P.S. I suggest that you make it a "READ ONLY" file. & store it on
; your P.C's HARD DRIVE.

; Script example on how to setup a dialog box e.g. dialogbox 4 16 620 350 2
; 4 = ID Number 16 = Left position 620 = Top position 350 = Length of box 2 = Depth of box

; There will be a % counter running in a separate box on the right hand side
; showing the progress of the script with number of changes left to do.

; If your source file (example below) has lines of data of this length or more, then the script will FAIL with a
; message of Error 1: Value out of range
; Please reduce the data for that line. e.g. a line of data that is too long is..
;1140,066 0 00 25,1140,0,74210,1,6,1421,10,1111,FBA CRPA HFA CNIA DNDA PUA VOLA VOUA CFXA ICRA,2,7000,74210,74210,0,0,SCR 4213 0,SCN 4212 0,SCN 4216 0,SCN 4218 0,SCN 4219 0,SCN 4222,ADL 8 4230,ADL 8 4019,ADL 8 5302,SCN 4211 0,SCN 4791 0,ADL 8, ,CFW 6,RNP,SSU 10 (262 CHARACTERS!)

; Trim the data down to e.g.
;1140,066 0 00 25,1140,0,74210,1,6,1421,10,1111,FBA CRPA HFA CNIA DNDA PUA VOLA VOUA CFXA ICRA,2,7000,74210,74210,0,0,SCR 4213 0,SCN 4212 0,SCN 4216 0,SCN 4218 0,SCN 4219 0,SCN 4222,ADL 8 4230,ADL 8 4019,ADL 8 5302,SCN 4211,SCN 4791,ADL 8, ,CFW 6,RNP,SSU 10

#include "vkeys.inc" ; You must have this file vkeys.inc
; located within the Aspect folder!

long LTime1
long LTime2
integer diff_sec
integer disp_sec
integer diff_min
integer disp_min
integer diff_hrs
integer left_sec
integer left_min
integer left_hrs
integer disl_sec
integer disl_min
INTEGER LEN=0
INTEGER CUT_OFF=0
LONG COUNT=0
LONG TOTAL=0
LONG PERCENT=0
INTEGER PERCENT_CHG_CHK=0
LONG BIT

string s_item_arr[10]
string s_ftr_arr[10]
string s_opdata[2]
STRING F_Time

PROC MAIN
integer i_tmp
integer i_ch
integer i_evt
integer i_sw_lev
integer i_mdm_clrdwn
integer i_fch_tx_val
integer i_tx_val
integer i_p
long l_tot_no_lin
long l_lin_cnt
long l_prog_bar_op
long l_fi_sz0
long l_cur_fi_sz0

string s_fi_nm
string s_tx_list = "0,5,10,15,20,25,40,50,100,120,150,200,300,400,500,700"
string s_tx_item = "120"
string s_dir
string s_progress
string s_pwd
string s_userid
string s_time_start
string s_date_start
string s_prog_bar
string s_sce_lin
string s_fi_ext_list = "*.*,*.CAP,*.CSV,*.DOC,*.LOG,*.TXT"
string s_fi_ext_item = "*.CSV"
string s_type_list = "File,2006,2008,2009,2018,2112,2317,2216,2616,3901,3902,3903,3903H,3903V,3904,3904H,3904V,3905,I2001,I2002,I2004,I2050,PCA,2001P2,2002P1,2002P2,2004P1,2004P2,2033,2050PC,2050MC,2210,2211,2212,1110,2007,1120,1140,1150,UEXT,500"
string s_type_item = "File"

dialogbox 0 4 16 610 420 2 " Procomm Plus Easy Change script file program For Nortel Extn DIGITAL Sets [V2.04 TSP 14th April 2009]"
groupbox 53 12 310 320 100 " Enter if required, the delayed start date / time in the box's below to run this script file"
text 54 20 320 296 11 "If the script auto starts before the date required, then select a different time period!" center
text 55 20 330 296 11 "I've found that the script will auto time start OK just before midnight i.e. 23:59:59!" center

editbox 1 32 124 149 11 s_item_arr[0]
editbox 2 32 143 149 11 s_item_arr[1]
editbox 3 32 160 149 11 s_item_arr[2]
editbox 4 32 179 149 11 s_item_arr[3]
editbox 5 32 197 149 11 s_item_arr[4]
editbox 6 32 218 149 11 s_item_arr[5]
editbox 7 32 234 149 11 s_item_arr[6]
editbox 8 32 253 149 11 s_item_arr[7]
editbox 9 32 271 149 11 s_item_arr[8]
editbox 10 32 290 149 11 s_item_arr[9]
editbox 11 229 125 149 11 s_ftr_arr[0]
editbox 12 229 143 149 11 s_ftr_arr[1]
editbox 13 229 161 149 11 s_ftr_arr[2]
editbox 14 229 180 149 11 s_ftr_arr[3]
editbox 15 229 198 149 11 s_ftr_arr[4]
editbox 16 229 218 149 11 s_ftr_arr[5]
editbox 17 229 235 149 11 s_ftr_arr[6]
editbox 18 229 253 149 11 s_ftr_arr[7]
editbox 19 229 272 149 11 s_ftr_arr[8]
editbox 20 229 290 149 11 s_ftr_arr[9]
groupbox 21 12 110 190 200 " Item"
groupbox 22 210 110 190 200 " Key"

text 60 45 340 280 11 "If you want the program to Date start enter the Date as e.g. 23/12/05 in the box below" center
text 61 30 360 248 11 "Pressing the (Space Bar) = Auto Start, or enter the required Date for it to run" left
text 62 280 350 34 9 "Dy/Mh/Yr" center
editbox 33 280 360 38 11 s_date_start 8

text 56 50 375 268 11 "If you want the program to Time start enter the time in 24Hr format in the box below" left
text 57 30 395 248 11 "Pressing the (Space Bar) = Auto Start, or enter the start Time = e.g. 16:20:00 " left
text 58 280 385 34 9 "Hr:Mn:Sc" center
editbox 34 280 395 38 11 s_time_start 8

dirpath 23 410 6 190 25 s_dir
combobox 30 410 24 40 80 DROPDOWNLIST s_fi_ext_list s_fi_ext_item SORT
dirlistbox 24 470 24 125 60 s_fi_ext_item SINGLE s_fi_nm 23 SORT
text 67 410 80 43 11 "Set Type" center
combobox 32 410 90 44 350 DROPDOWNLIST s_type_list s_type_item SORT ;FILE

text 27 470 80 62 11 "Transmit Cadence" left
combobox 26 480 90 34 170 DROPDOWNLIST s_tx_list s_tx_item
text 51 430 105 200 11 "A higher Transmit Cadence number is needed " left
text 52 430 116 200 11 "to slow the program down for older processors. " left

groupbox 63 410 130 190 55 " Example shown is a Source file based on a *.csv format"
text 59 420 140 140 11 " TN Number followed by the Extn TYPE" center
text 65 420 150 140 11 " 004 0 00 00 , 2616" center
text 36 420 160 140 11 " 004 0 00 01 , 3904" center
text 37 420 170 140 11 " 096 0 00 14 , I2004" center

groupbox 64 410 190 190 60 " Enter the systems Login Name and Password below"
editbox 35 460 210 74 11 s_userid 11
text 66 413 199 185 11 " Name / UserID (No Name = Space Bar)" center
editbox 31 460 236 74 11 s_pwd 16 MASKED
text 68 420 225 140 11 " Switch Password is Case Sensitive for V4.5 onwards" center

groupbox 69 410 255 190 56 " What this script will do after changes have been made!"
text 70 430 265 146 11 "LD 32 is accessed to cancel any alarms" center
text 71 430 276 146 11 "LD 83 sets are printed After completion" center
text 72 430 287 146 11 "LD 43 is accessed and a EDD is done" center
text 73 430 298 146 11 "This script will then logoff and exit the system " center

groupbox 41 12 8 190 100 " Against Item below on the Left hand side put in e.g."
text 43 30 25 149 11 "NCOS 6 (First Line)" left
text 44 30 35 149 11 "CLS CFXA DPUA LNA (Second Line)" left
text 45 30 45 149 11 "RNPG 2 (Third Line) etc and so on!" left
text 46 30 65 149 11 " Do all this as required until you have finished" center
text 38 30 75 149 11 "This column can also be used for Items" center
text 39 30 85 149 11 "On 500 sets. (post V19 software) only!" center

groupbox 42 210 8 190 100 " Against Key below on the Right hand side put in e.g."
text 47 227 25 149 11 " 1 CFW 16 (First Line) (1) = KEY 1" left
text 48 227 35 149 11 " 3 SSU 10 (Second Line) (3) = KEY 3" left
text 49 227 45 149 11 " 4 ADL 16 9003898989 (Third Line) etc!" left
text 50 227 65 149 11 " Do all this as required until you have finished" center
text 74 227 75 149 11 " Then press the Tab key to select the start time" center

checkbox 25 350 396 74 11 "Pre 19.xx Software" i_sw_lev
checkbox 78 350 406 130 11 "Modem cleardown on completion" i_mdm_clrdwn

groupbox 75 340 315 260 79 " Read this section FIRST! if you intend to use the delayed start function "
text 76 350 329 242 33 " Please remember to amend your capture file settings under the following headings's (Options, Data Options, Setup Files, Capture File Options, Control Options) to UNCHECK the box marked (Query for file name when capture is started)!. " left
text 77 350 367 243 20 " Click (OK) & (OK) again before starting this script program. This will make the script run and produce a log file without any other further manual assistance. " left

pushbutton 28 490 400 40 13 "Accept"
pushbutton 29 540 400 40 13 "Cancel"

enddialog

WHEN TARGET 1 "OVL111 " CALL OVL111
WHEN TARGET 2 "OVL428 " CALL OVL428
; WHEN TARGET 3 "SCH0099 " CALL SCH0099 ; TYPE = 2500
; WHEN TARGET 4 "SCH0111 " CALL SCH0111 ; TYPE = 2000
WHEN TARGET 5 "SCH0101 " CALL SCH0101
WHEN TARGET 6 "NACT " CALL NACT
WHEN TARGET 7 "MARP ON " CALL MARP
WHEN TARGET 8 "ERR3056 " CALL CUTOFF

disable dlgctrl 0 2 10
disable dlgctrl 0 12 20

while 1
dlgevent 0 i_evt
switch i_evt
case 0
if nullstr s_fi_nm
disable dlgctrl 0 28
disable dlgctrl 0 28
elseif nullstr s_date_start
disable dlgctrl 0 28
elseif nullstr s_time_start
disable dlgctrl 0 28
elseif nullstr s_userid
disable dlgctrl 0 28
elseif nullstr s_pwd
disable dlgctrl 0 28
else
if not nullstr s_item_arr[0]
enable dlgctrl 0 28
endif
if not nullstr s_ftr_arr[0]
enable dlgctrl 0 28
endif
endif
endcase
case 1
if not nullstr s_item_arr[0]
upd_str_dlg_1(0,0,0,1,0,2,KV_SHIFT,VK_TAB)
endif
endcase
case 2
if not nullstr s_item_arr[1]
upd_str_dlg_1(0,1,0,2,0,3,KV_SHIFT,VK_TAB)
endif
endcase
case 3
if not nullstr s_item_arr[2]
upd_str_dlg_1(0,2,0,3,0,4,KV_SHIFT,VK_TAB)
endif
endcase
case 4
if not nullstr s_item_arr[3]
upd_str_dlg_1(0,3,0,4,0,5,KV_SHIFT,VK_TAB)
endif
endcase
case 5
if not nullstr s_item_arr[4]
upd_str_dlg_1(0,4,0,5,0,6,KV_SHIFT,VK_TAB)
endif
endcase
case 6
if not nullstr s_item_arr[5]
upd_str_dlg_1(0,5,0,6,0,7,KV_SHIFT,VK_TAB)
endif
endcase
case 7
if not nullstr s_item_arr[6]
upd_str_dlg_1(0,6,0,7,0,8,KV_SHIFT,VK_TAB)
endif
endcase
case 8
if not nullstr s_item_arr[7]
upd_str_dlg_1(0,7,0,8,0,9,KV_SHIFT,VK_TAB)
endif
endcase
case 9
if not nullstr s_item_arr[8]
upd_str_dlg_1(0,8,0,9,0,10,KV_SHIFT,VK_TAB)
endif
endcase
case 10
if not nullstr s_item_arr[9]
strupr s_item_arr[9]
dlgupdate 0 10
endif
endcase
case 11
if not nullstr s_ftr_arr[0]
upd_str_dlg_1(1,0,0,11,0,12,KV_SHIFT,VK_TAB)
endif
endcase
case 12
if not nullstr s_ftr_arr[1]
upd_str_dlg_1(1,1,0,12,0,13,KV_SHIFT,VK_TAB)
endif
endcase
case 13
if not nullstr s_ftr_arr[2]
upd_str_dlg_1(1,2,0,13,0,14,KV_SHIFT,VK_TAB)
endif
endcase
case 14
if not nullstr s_ftr_arr[3]
upd_str_dlg_1(1,3,0,14,0,15,KV_SHIFT,VK_TAB)
endif
endcase
case 15
if not nullstr s_ftr_arr[4]
upd_str_dlg_1(1,4,0,15,0,16,KV_SHIFT,VK_TAB)
endif
endcase
case 16
if not nullstr s_ftr_arr[5]
upd_str_dlg_1(1,5,0,16,0,17,KV_SHIFT,VK_TAB)
endif
endcase
case 17
if not nullstr s_ftr_arr[6]
upd_str_dlg_1(1,6,0,17,0,18,KV_SHIFT,VK_TAB)
endif
endcase
case 18
if not nullstr s_ftr_arr[7]
upd_str_dlg_1(1,7,0,18,0,19,KV_SHIFT,VK_TAB)
endif
endcase
case 19
if not nullstr s_ftr_arr[8]
upd_str_dlg_1(1,8,0,19,0,20,KV_SHIFT,VK_TAB)
endif
endcase
case 20
if not nullstr s_ftr_arr[9]
strupr s_ftr_arr[9]
dlgupdate 0 20
endif
endcase
case 28
exitwhile
endcase
case 29
exitwhile
endcase
case 30
dlgupdate 0 24
endcase
case 31
strlen s_pwd i_tmp
if i_tmp < 4
usermsg "Password `"%s`"`n`nThis must be between 4-16 characters in length & it is case sEnsTivE on V04.50 onwards!" s_pwd
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
endif
endcase
case 33
strlen s_date_start i_tmp
if i_tmp < 1
usermsg "Start Date `"%s`"`n`nmust be 6 Numbers in length and with a (/) in between every 2 digits. or you can just press the Space Bar to leave the box blank to auto start the program" s_date_start
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
elseif i_tmp > 8
usermsg "Start Date `"%s`"`n`nmust be 6 Numbers in length and with a (/) in between every 2 digits. or you can just press the Space Bar to leave the box blank to auto start the program" s_date_start
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
endif
endcase
case 34
strlen s_time_start i_tmp
if i_tmp < 1
usermsg "Start Time `"%s`"`n`nmust be 6 Numbers in length and with a :)) in between every 2 digits. or you can just press the Space Bar to leave the box blank to auto start the program" s_time_start
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
elseif i_tmp > 8
usermsg "Start Time `"%s`"`n`nmust be 6 Numbers in length and with a :)) in between every 2 digits. or you can just press the Space Bar to leave the box blank to auto start the program" s_time_start
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
endif
endcase
case 35
strlen s_userid i_tmp
if i_tmp < 1
usermsg "Name or UserID `"%s`"`n`nName can be up to 11 Characters. Otherwise enter a dummy name or press the Space Bar to accept the entry" s_userid
sendvkey MAKE_KV(KV_SHIFT,VK_TAB)
endif
endcase
; case 36
; endcase
; case 37
; endcase
case 38
endcase
endswitch
endwhile

dlgdestroy 0 cancel

if i_evt != 28
exit
endif

if not fopen 0 s_fi_nm read
errormsg "Couldn't open file `"%s`"." s_fi_nm
else
cnt_no_fi_lines(i_ch,&l_tot_no_lin,&l_fi_sz0)

fetch txpace i_fch_tx_val
atoi s_tx_item i_tx_val
strcat s_tx_item " ms"
set txpace i_tx_val

STATMSG "Waiting for the auto start date/time of Program to change digital extns using a source file e.g. sets.csv example = 004 0 00 00,2616"

datetimestart(s_time_start,s_date_start)
logi(s_userid)
login(s_pwd)
ld_ovl_11(i_sw_lev)

dialogbox 1 350 52 280 65 14 " Progress status bar for the easy change DIGITAL sets script program"
text 1 8 16 65 11 s_progress left
editbox 2 8 32 210 11 s_prog_bar
text 3 8 45 270 11 s_fi_nm left
text 4 175 5 55 11 "Transmit Pace" left
text 6 90 16 80 11 s_sce_lin left
text 5 185 16 35 11 s_tx_item left
text 7 90 5 70 11 "TN Number Type" left
text 8 8 5 60 11 "Source file line No" left
enddialog

l_prog_bar_op = l_fi_sz0/40

while not feof 0
fgetc 0 i_ch
if not feof 0
ftell 0 l_cur_fi_sz0
if l_cur_fi_sz0 % l_prog_bar_op == 0
strcat s_prog_bar "#"
dlgupdate 1 2
endif
if i_ch == '`r'
loopwhile
endif
if i_ch == '`n'
l_lin_cnt++
strputc s_sce_lin i_p 0
if not nullstr s_sce_lin

get_opdata(s_sce_lin,s_type_item)

strfmt s_progress "Line %ld of %ld" l_lin_cnt l_tot_no_lin
dlgupdate 1 1
dlgupdate 1 6
s_sce_lin = ""
i_p = 0

send_opdata(i_sw_lev,s_type_item)

loopwhile
endif
endif
strputc s_sce_lin i_p i_ch
i_p++
endif
endwhile

ex_ovl_11()

set txpace i_fch_tx_val
fclose 0

endif

dlgdestroy 1 cancel

CALL ALARMS_LIST
CALL LOGO
LD_LOGO(i_mdm_clrdwn)

endproc

proc get_opdata ;#####

param string s_sce_lin
param string s_type_item

strtok s_opdata[0] s_sce_lin "," ; TN Number
if strcmp s_type_item "File"
strtok s_opdata[1] s_sce_lin "," ; Extn TYPE
endif

CAPTURE ON

endproc

PROC COUNTER
BIT=COUNT*100
; PERCENT=BIT/TOTAL

strsltime $DATE $TIME24 LTime2

diff_sec = LTime2 - LTime1
diff_min = diff_sec/60
diff_hrs = diff_min/60

disp_sec = diff_sec - (diff_min*60)
disp_min = diff_min - (diff_hrs*60)

if PERCENT_CHG_CHK < PERCENT
PERCENT_CHG_CHK = PERCENT
left_sec = (((diff_sec*1000)/percent)*(100-percent)/1000)
left_min = left_sec/60
left_hrs = left_min/60

disl_sec = left_sec - (left_min*60)
disl_min = left_min - (left_hrs*60)
endif
STATMSG "%i of %i - %i %% Done - Run Time: %02d:%02d:%02d - Time Left: %02d:%02d:%02d No of Extn Resets = %i" COUNT TOTAL PERCENT diff_hrs disp_min disp_sec left_hrs disl_min disl_sec CUT_OFF

endproc

proc send_opdata ;#####

param integer i_sw_lev
param string s_type_item
integer i_cnt_a
integer i_cnt_b
string s_tmp_a
string s_tmp_b

txdc ("CHG")
if i_sw_lev
waitfor "TYPE "
else
waitfor "TYPE: "
endif
if strcmp s_type_item "File"
txdc (s_opdata[1])
else
txdc (s_type_item)
endif
waitfor "TN "
txdc (s_opdata[0])
waitfor "ECHG "
txdc ("YES")
waitfor "ITEM "

for i_cnt_a = 0 upto 9
if not nullstr s_item_arr[i_cnt_a]
if strncmp s_item_arr[i_cnt_a] "DES" 3
strcpy s_tmp_a s_item_arr[i_cnt_a]
strtok s_tmp_b s_tmp_a " " 2
txdt ("DES ")
waitfor "DES "
waitfor "DES "
txdc (s_tmp_b)
else
txdc (s_item_arr[i_cnt_a])
endif
waitfor "ITEM "
endif
endfor

i_cnt_b = 0
for i_cnt_a = 0 upto 9
if not nullstr s_ftr_arr[i_cnt_a]
i_cnt_b++
if i_cnt_b == 1
txdt ("KEY ")
waitfor "KEY "
endif
txdc (s_ftr_arr[i_cnt_a])
waitfor "KEY "
endif
if i_cnt_a == 9 && i_cnt_b >= 1
txdc ("")
waitfor "ITEM "
endif
endfor

txdc ("")
if i_sw_lev
waitfor "REQ "
else
waitfor "REQ: "
endif

count=count+1
CALL COUNTER
; ENDWHILE
; FCLOSE 1
;endif

endproc

proc cnt_no_fi_lines ;#####

param integer i_ch
param long l_tot_no_lin
param long l_fi_sz0

while not feof 0
fgetc 0 i_ch
if not feof 0
if i_ch == '`n'
l_tot_no_lin++
endif
endif
endwhile

ftell 0 l_fi_sz0
rewind 0

; WHILE NOT FEOF 1
; FGETS 1 s_opdata[1]
STRLEN s_opdata[1] LEN
IF LEN<3
; EXITWHILE
ENDIF

TOTAL=TOTAL+1
; ENDWHILE

strsltime $DATE $TIME24 LTime1

CALL COUNTER
REWIND 0
; WHILE NOT fEOF 1
; FGETS 1 s_opdata[1]
STRLEN s_opdata[1] LEN
IF LEN<3
; EXITWHILE
ENDIF
endproc

proc upd_str_dlg_1 ;#####

param integer i_arr_fl
param integer i_arr_elem
param integer i_dlg_upd_box
param integer i_dlg_upd_ctrl
param integer i_dlg_enl_box
param integer i_dlg_enl_ctrl
param integer i_state_val
param integer i_key_val

if i_arr_fl == 0
strupr s_item_arr[i_arr_elem]
elseif i_arr_fl == 1
strupr s_ftr_arr[i_arr_elem]
endif
dlgupdate i_dlg_upd_box i_dlg_upd_ctrl
enable dlgctrl i_dlg_enl_box i_dlg_enl_ctrl
sendvkey MAKE_KV(i_state_val,i_key_val)

endproc

proc txdt ;#####

param string s_txs
integer i_p = 0
integer i_ch = -1
strgetc s_txs i_P i_ch
i_p++
while i_ch != 0
computc i_ch
strgetc s_txs i_P i_ch
i_P++
endwhile
endproc

proc txdc ;#####

param string s_txs
integer i_p = 0
integer i_ch = -1

strgetc s_txs i_P i_ch
i_p++

while i_ch != 0
computc i_ch
strgetc s_txs i_P i_ch
i_P++
endwhile

computc 13

endproc

proc ld_ovl_11 ;#####
param integer i_sw_lev
txdc ("****")
pause 3
; waitfor ">"
txdc ("LD 11")
if i_sw_lev
pause 4
waitfor "REQ "
else
waitfor "REQ: "
endif
endproc

proc ex_ovl_11 ;#####
txdc ("END")
waitfor ">"
endproc

PROC OVL111
txdc ("****")
waitfor ">"
USERMSG "Script failed, as the TTY user is NOT logged into the system!"
exit
endproc

PROC NACT
txdc ("")
endproc

PROC OVL428
USERMSG "Script failed. The Login name & password combination is invalid. Check the password & login name & try again.!"
exit
endproc

PROC SCH0101
pause 2
txdc ("***")
STATMSG "Please wait 30 seconds as the TTY is already logged in!"
endproc

;PROC SCH0099
; txdc ("**") ; Was set to ("500")
;endproc

;PROC SCH0111
; pause 2
; txdc ("**")
;; waitfor "REQ"
;; txdc ("CHG")
;; waitfor "TYPE"
;; txdc ("2616")
;endproc

PROC CUTOFF
CUT_OFF=CUT_OFF+1
endproc

PROC MARP
txdc ("")
endproc

PROC DATETIMESTART
param string s_time_start
param string s_date_start
integer i_tmp

strlen s_date_start i_tmp
if i_tmp >5
strlen s_time_start i_tmp
if i_tmp <2
s_time_start = "00:10:00"
endif
endif
strlen s_time_start i_tmp
if i_tmp >5
strlen s_date_start i_tmp
if i_tmp <2
s_date_start = $DATE
endif
endif

Waituntil s_time_start s_date_start
endproc

Proc TTY_LOGIN
pause 3
txdc ("LOGI")
endproc

proc logi ;#####
param string s_userid
When Target 0 "OVL014 " CALL OVL014
When Target 1 "OVL428 " CALL OVL428
When Target 2 "SCH0510 " CALL OVL014
WHEN TARGET 3 "OVL013 " CALL TTY_LOGIN

transmit "LOGI "
txdc (s_userid)
waitfor "PASS?"
endproc

proc login ;#####
param string s_pwd
txdc (s_pwd)
waitfor ">"
endproc

PROC LOGO
txdc ("****")
pause 4
txdc ("LOGO") ; Check this box if you DON'T want to log out!
F_Time=$TIME
statmsg "Easy change for the Procomm Plus DIGITAL extn sets program is complete`n`n at %s" F_TIME
endproc

PROC LD_LOGO
param integer i_mdm_clrdwn
if i_mdm_clrdwn
txdc ("")
waitfor "TTY"
pause 2
transmit "+++"
pause 2
waitfor "OK"
pause 2
txdc ("ATH0")
Capture Off
usermsg "Modem cleardown & easy change for the DIGITAL extn sets program is complete`n`n at %s" F_TIME
exit
else
txdc ("")
waitfor ">"
pause 2
endif
Capture Off
usermsg "Easy change for the Procomm Plus DIGITAL extn sets program is complete`n`n at %s" F_TIME
exit
endproc

PROC OVL014
STATMSG "Please wait 30 seconds as the TTY is already logged in!"
endproc

PROC ALARMS_LIST

; ######## TO CANCEL ANY ALARMS IN LD 32 AFTER CHANGES ARE MADE

txdc ("LD 32")
pause 8
txdc ("CMIN ALL")
txdc ("CDSP")
txdc ("****")

; ######## TO LIST DATE CHANGE IN LD 83 AFTER EASYCHG IS DONE

txdc ("LD 83")
waitfor "REQ"
txdc ("LST")
waitfor "CUST "
txdc ("")
waitfor "DATE "
txdc ("")
waitfor "PAGE "
txdc ("")
; waitfor "NACT "
; txdc ("")
pause 4
waitfor "REQ " FOREVER
pause 4
txdc ("END")

; ###################### "VERSION 19.xx Onwards, Time Forward / Backward 1 Hour!"
; "United Kingdom Settings!"

; txdc ("LD 2")
; pause 8
; txdc ("TTAD")
; txdc ("TDST")
; txdc ("FWTM 3 5 1 02")
; txdc ("BWTM 10 5 1 02")
; txdc ("SDST ON")
; txdc ("****")

; ######## TO DO A DUMP IN LD 43 AFTER CHANGES ARE MADE

txdc ("LD 43")
pause 8
txdc ("EDD")
pause 250
; waitfor "." forever
txdc ("")
waitfor "EDD000"
txdc ("****")
endproc


; The information listed below has been taken from the "vkeys.inc" file.
; I have added in one ";" against each line for use with this file!.
; Should your copy of "vkeys.inc" be missing or damaged, then you can copy this
; section listed below with one of the ";" removed for each line!.


;;Definitions of standard virtual key code values
;;**********************************************************************
;;* VKEYS.INC
;;* Copyright (c) 1999 Symantec Corporation
;;*
;;* Definitions of standard virtual key code values. Use these macro
;;* definitions in your ASPECT script files rather than hard-coded
;;* constants to improve maintainability and readability. For more
;;* information, see the keyval and vkey conventions described in the
;;* Windows ASPECT Script Language reference manual.
;;**********************************************************************

;#ifndef _INC_VKEYS ; if file not already included
;#define _INC_VKEYS ; prevent further inclusion

;;**********************************************************************
;;* Macro definitions of standard virtual key code values
;;**********************************************************************

;#define VK_LBUTTON 0x01 ; Left mouse button
;#define VK_RBUTTON 0x02 ; Right mouse button
;#define VK_CANCEL 0x03 ; Ctrl-Break
;#define VK_MBUTTON 0x04 ; Middle mouse button
;; 0x05-0x07 ; Undefined
;#define VK_BACK 0x08 ; Backspace key
;#define VK_TAB 0x09 ; Tab key
;; 0x0A-0x0B ; Undefined
;#define VK_CLEAR 0x0C ; Clear key or Keypad 5 with Num lock off
;#define VK_RETURN 0x0D ; Enter or Return key
;; 0x0E-0x0F ; Undefined
;#define VK_SHIFT 0x10 ; Shift key
;#define VK_CONTROL 0x11 ; Control or Ctrl key
;#define VK_MENU 0x12 ; Menu or Alt key
;#define VK_pause 0x13 ; pause key
;#define VK_CAPITAL 0x14 ; Capital or Caps Lock key
;; 0x15-0x19 ; Reserved for Kanji Systems
;; 0x1A ; Undefined
;#define VK_ESCAPE 0x1B ; Esc or Escape key
;; 0x1C-0x1F ; Reserved for Kanji Systems
;#define VK_SPACE 0x20 ; Spacebar
;#define VK_PRIOR 0x21 ; Page Up key
;#define VK_NEXT 0x22 ; Page Down key
;#define VK_END 0x23 ; End key
;#define VK_HOME 0x24 ; Home key
;#define VK_LEFT 0x25 ; Left arrow key
;#define VK_UP 0x26 ; Up Arrow key
;#define VK_RIGHT 0x27 ; Right Arrow key
;#define VK_DOWN 0x28 ; Down Arrow key
;#define VK_SELECT 0x29 ; Select key
;#define VK_PRINT 0x2A ; Keyboard (OEM) specific
;#define VK_EXECUTE 0x2B ; Execute key
;#define VK_SNAPSHOT 0x2C ; Print Screen key
;#define VK_INSERT 0x2D ; Insert key
;#define VK_DELETE 0x2E ; Delete key
;#define VK_HELP 0x2F ; Help key
;#define VK_0 0x30 ; 0 key
;#define VK_1 0x31 ; 1 key
;#define VK_2 0x32 ; 2 key
;#define VK_3 0x33 ; 3 key
;#define VK_4 0x34 ; 4 key
;#define VK_5 0x35 ; 5 key
;#define VK_6 0x36 ; 6 key
;#define VK_7 0x37 ; 7 key
;#define VK_8 0x38 ; 8 key
;#define VK_9 0x39 ; 9 key
;; 0x3A-0x40 ; Undefined
;#define VK_A 0x41 ; A key
;#define VK_B 0x42 ; B key
;#define VK_C 0x43 ; C key
;#define VK_D 0x44 ; D key
;#define VK_E 0x45 ; E key
;#define VK_F 0x46 ; F key
;#define VK_G 0x47 ; G key
;#define VK_H 0x48 ; H key
;#define VK_I 0x49 ; I key
;#define VK_J 0x4A ; J key
;#define VK_K 0x4B ; K key
;#define VK_L 0x4C ; L key
;#define VK_M 0x4D ; M key
;#define VK_N 0x4E ; N key
;#define VK_O 0x4F ; O key
;#define VK_P 0x50 ; P key
;#define VK_Q 0x51 ; Q key
;#define VK_R 0x52 ; R key
;#define VK_S 0x53 ; S key
;#define VK_T 0x54 ; T key
;#define VK_U 0x55 ; U key
;#define VK_V 0x56 ; V key
;#define VK_W 0x57 ; W key
;#define VK_X 0x58 ; X key
;#define VK_Y 0x59 ; Y key
;#define VK_Z 0x5A ; Z key
;#define VK_WINDOWSL 0x5B ; Windows key (left)
;#define VK_WINDOWSR 0x5C ; Windows key (right)
;#define VK_APPLICATION 0x5D ; Application key
;; 0x5E-0x5F ; Undefined
;#define VK_NUMPAD0 0x60 ; Numeric Keypad 0
;#define VK_NUMPAD1 0x61 ; Numeric Keypad 1
;#define VK_NUMPAD2 0x62 ; Numeric Keypad 2
;#define VK_NUMPAD3 0x63 ; Numeric Keypad 3
;#define VK_NUMPAD4 0x64 ; Numeric Keypad 4
;#define VK_NUMPAD5 0x65 ; Numeric Keypad 5
;#define VK_NUMPAD6 0x66 ; Numeric Keypad 6
;#define VK_NUMPAD7 0x67 ; Numeric Keypad 7
;#define VK_NUMPAD8 0x68 ; Numeric Keypad 8
;#define VK_NUMPAD9 0x69 ; Numeric Keypad 9
;#define VK_MULTIPLY 0x6A ; Multiply key
;#define VK_ADD 0x6B ; Add key
;#define VK_SEPARATOR 0x6C ; Separator key
;#define VK_SUBTRACT 0x6D ; Subtract key
;#define VK_DECIMAL 0x6E ; Decimal key
;#define VK_DIVIDE 0x6F ; Divide key
;#define VK_F1 0x70 ; Function key F1
;#define VK_F2 0x71 ; Function key F2
;#define VK_F3 0x72 ; Function key F3
;#define VK_F4 0x73 ; Function key F4
;#define VK_F5 0x74 ; Function key F5
;#define VK_F6 0x75 ; Function key F6
;#define VK_F7 0x76 ; Function key F7
;#define VK_F8 0x77 ; Function key F8
;#define VK_F9 0x78 ; Function key F9
;#define VK_F10 0x79 ; Function key F10
;#define VK_F11 0x7A ; Function key F11
;#define VK_F12 0x7B ; Function key F12
;#define VK_F13 0x7C ; Function key F13
;#define VK_F14 0x7D ; Function key F14
;#define VK_F15 0x7E ; Function key F15
;#define VK_F16 0x7F ; Function key F16
;#define VK_F17 0x80 ; Function key F17
;#define VK_F18 0x81 ; Function key F18
;#define VK_F19 0x82 ; Function key F19
;#define VK_F20 0x83 ; Function key F20
;#define VK_F21 0x84 ; Function key F21
;#define VK_F22 0x85 ; Function key F22
;#define VK_F23 0x86 ; Function key F23
;#define VK_F24 0x87 ; Function key F24
;; 0x88-0x8F ; Unassigned
;#define VK_NUMLOCK 0x90 ; Num Lock key
;#define VK_OEM_SCROLL 0x91 ; Scroll Lock key
;; 0x92-0xB9 ; Unassigned
;; 0xBA-0xC0 ; Keyboard (OEM) specific
;; 0xC1-0xDA ; Unassigned
;; 0xDB-0xE4 ; Keyboard (OEM) specific
;; 0xE5 ; Unassigned
;; 0xE6 ; Keyboard (OEM) specific
;; 0xE7-0xE8 ; Unassigned
;; 0xE9-0xF5 ; Keyboard (OEM) specific
;; 0xF6-0xFE ; Unassigned

;;**********************************************************************
;;* Useful macros for testing and forming key values from keyboard
;;* shift states and virtual key code values.
;;**********************************************************************

;#define KV_SHIFT 0x01 ; Shift key pressed
;#define KV_CTRL 0x02 ; Ctrl key pressed
;#define KV_ALT 0x04 ; Alt key pressed
;#define KV_EXT 0x08 ; Extended key flag
;#define KV_CAPSLOCK 0x10 ; Caps Lock key toggled on

;#define MAKE_KV(skeys,vkey) (((skeys) << 8) | (vkey))

;#define KV_VKEY(keyval) ((keyval) & 0xFF)
;#define KV_SKEYS(keyval) ((keyval) >> 8)

;#define KV_SHIFTKEY(keyval) (KV_SKEYS(keyval) & KV_SHIFT)
;#define KV_CTRLKEY(keyval) (KV_SKEYS(keyval) & KV_CTRL)
;#define KV_ALTKEY(keyval) (KV_SKEYS(keyval) & KV_ALT)
;#define KV_EXTKEY(keyval) (KV_SKEYS(keyval) & KV_EXT)

;#endif ; _INC_VKEYS

Samo
 
Sorry I didn't get back sooner, was away from the computer most of the weekend.

The script you posted compiled OK for me, did you mean to post a different one?

Can you post an example of the text file you need to read? You can likely use a command like strtok to break the columns into separate strings and get the individual pieces of data that way.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top