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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automate logging onto various ipaddress

Status
Not open for further replies.

bebe2323

Vendor
Jan 30, 2009
8
US
Hi,
I need a script that can reference an excel spread sheet pull an ip address then telnet into that ip address log me on and run a script capture the result and put it back on a excel spread sheet so for i am doing all of this manually i have 500 plus sites that i want to automate.
here is what i have i run these separate
;Recorded script. Editing may be required.

proc main

waitfor "ENTER USERNAME < ^H "

transmit "^M"

waitfor "ENTER PASSWORD < ^H "

transmit "^M"

waitfor "< ^H "

transmit "ZIAG;^M"

waitfor "OLD PASSWORD:"

transmit "^M"

waitfor "NEW PASSWORD:"

transmit "^M"

waitfor "VERIFICATION:"

transmit "^M"

endproc

proc main


string szipaddress
string szusername
string szpassword


sdlginput "IP ADDRESS" "Enter IP Address" szipaddress

connectmanual telnet szipaddress


waitfor "username: "
sdlginput "User Name" "Enter User Name" szusername
transmit szusername
transmit "^m"

waitfor "Password: "
sdlginput "Password" "Enter Password" szpassword
transmit szpassword
transmit "^m"


waitfor "$"
transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "$"
waitfor "$"
transmit "lhsh 001200/port_2_dev_22 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_6_dev_23 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_10_dev_24 fui get vswr^m"
waitfor "$"

transmit "lhsh 001200/port_0_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_11 fui get vswr^m"
waitfor "$"



transmit "lhsh 001200/port_4_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_11 fui get vswr^m"
waitfor "$"





transmit "lhsh 001200/port_8_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_11 fui get vswr^m"


waitfor "$"
transmit "lhsh 001200/port_2_dev_20 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_6_dev_21 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_10_dev_22 fui get vswr^m"




waitfor "$"


endproc

 
Hehe, sounds familiar..

I've built a few of these in the past.

Here's some suggestions.

Working from a text file is much easier then excel, as far as reading in data. If possible, consider having your source of IP's be a text file.

Consider writing your data out as a .csv file. Again, easier then using excel. Not to discourage you for using DDE, it just adds layers of complexity.

Here's an example of reading in a list of IP's and taking an action...

Code:
   string sIP
   string sMarket
   string sTemp
   string oldpass = "oldpassword^m"
   string newpass = "newpassword^m"
   

proc main
 
   ;integer iChoice
   set capture path "c:\SwitchAudit\"
   
   if fopen 0 "c:\switchlist.txt" READ TEXT        ;Open text file containing list of connections
      while not feof 0                             ;While data remains in the file
         fgets 0 sTemp                             ;Get entry from file
         strtok sIP sTemp "`t" 1
         strtok sMarket sTemp "`t" 1
	 
	 strcat sMarket ".txt"
	 
	 set capture file sMarket
	 
         if not nullstr sMarket                       ;If entry is not blank
            connectmanual TELNET sIP                         ;Then dial it
            waitfor ">" forever
            transmit "username^m"
            waitfor ">" forever
            transmit oldpass
            waitfor ">" forever
            clear
            pause 2
            transmit "password^m"
            waitfor ">" forever
            transmit newpass
            waitfor ">" forever
            transmit newpass
            waitfor ">" forever
            transmit oldpass
            waitfor ">" forever
            transmit "logout^m"
            
            ;sdlgmsgbox "" sMarket NONE OK iChoice
            
            
            
         endif
      endwhile
   endif
   fclose 0                                        ;Close data file
endproc


And here is an example of reading data in from excel and acting on it.

[code]
;**************************************
; Build trunk groups in a DMS 100 based
; switch.  CLLI tuple must already
; exist, and the number of trunks
; should already reflect the final
; amount.
;	By:  Kevin Smith
;	6/3/05
; DDE code derived from samples at
; [URL unfurl="true"]www.aspectscripting.com[/URL]
;**************************************
; Removed code that skipped trkmember#'s
;**************************************

;**************************************
; Declare DDE variables.
;**************************************

long LinkVar, SystemVar                      ;Variables containing DDE Id's.
string szText                                ;Text read from DDE link to Excel.
integer iRow, iCol1                          ;Row and column variables
string sRowCol                               ;Holds request for row and column

;**************************************
; Main procedure below
;**************************************

integer iNumT
integer iIndexCIC
string sPort[90]

proc main

string sSkip,fName,sTRKINFO,sTGMU,sRECORDCPN,sRECORDCHN,sXMIT
string sNumT
string sStartCIC
string sTemp
string sTemp2
string sTemp3

string sCLLI
string sMEM
string sCICC7

integer iMEM
integer iIgnore
integer iIndexCIC2
integer iCIC

when target 0 "DMO REJECTED" MATCHCASE call test suspend
when target 1 "ENTER Y TO CONFIRM" MATCHCASE call test1
when target 2 "*** ERROR - INCONSISTENT DATA ***" MATCHCASE call test suspend
when target 3 "NO COMMAND IN LINE" call test2 suspend
when target 4 "*** ERROR ***" call test3 suspend

; ********** start at table trkmem ***************

usermsg "Ensure table CLLI has been modified to match new total number of trunks.`nTQ each carrier.`nVerifiy starting TCIC."

transmit "table trkmem^m"
waitfor ">" forever

sdlginput "CLLI" "Enter CLLI" sCLLI DEFAULT

iNumT = 0


sdlginput "(s)kip or (n)oskip?" "Skip/Noskip" sSkip DEFAULT

if strcmp sSkip "end"
	exit
endif

switch sSkip
	case "s"
	endcase
	case "n"
	endcase
	default
		sdlgmsgbox "" "Only s or n allowed" stop ok iIgnore
		exit
	endcase
endswitch

sdlginput "Starting Trunk Member #" "Mem#" sStartCIC DEFAULT
sCICC7 = sStartCIC

if strcmp sStartCIC "end"
	exit
endif

strtonum sStartCIC iIndexCIC 10

strrev sStartCIC

;if strcmp sSkip "s"
;	if strncmp sStartCIC "79" 2
;		sdlgmsgbox "Error" "Can't start at x97" stop ok iIgnore
;		exit
;	endif
;endif

strrev sStartCIC
strtonum sStartCIC iCIC 10


sTemp= "(S)kip or (N)oskip: "
sTemp3 = sSkip
strinsert sTemp3 sTemp 0

sTemp = "Starting CIC: "
strinsert sStartCIC sTemp 0


;**************************************
; Code here for DDE input for DTC's
;**************************************

   iCol1 = 1                                    ;Column one
   iRow = 1                                     ;Start reading with row 1

   if ddeinit SystemVar "excel" "system"
      ;ddeexecute SystemVar "[FULL(TRUE)]"       ;Maximize the spreadsheet.
      if ddeinit LinkVar "excel" "sheet1"       ;Set up link to spreadsheet.
         while 1                                ;Loop forever.
            strfmt sRowCol "R%dC%d" iRow iCol1  ;Format request for data from current row, column 1
               ;sdlgmsgbox "Here" sRowCol stop ok iTemp
            dderequest LinkVar sRowCol szText   ;Read data from spreadsheet, current row, column 1
   ;sdlgmsgbox "Here" szText stop ok iTemp
   	strreplace szText "`n" ""
   	strreplace szText "`r" ""
   	;szText = "end"
            if strcmp szText "end"	        ;If cell contains the string exit
           ; sdlgmsgbox szText "Exitwhile" stop ok iTemp
               exitwhile                        ;Exit the while loop.
            else
               ;strfmt sRowCol "R%dC%d" iRow iCol2
               ;dderequest LinkVar sRowCol szText;Read data from spreadsheet, current row, column 2
               iNumT ++
               sPort[iNumT] = szText
            endif
            iRow++                              ;Increment row value
         endwhile
         ddeterminate LinkVar                   ;Break DDE link to spreadsheet.
         ddeterminate SystemVar                 ;Break DDE link to Excel.
      else
         errormsg "Couldn't establish DDE link to spreadsheet!"
      endif
   else
      errormsg "Couldn't establish DDE link to Excel!"
   endif


;**************************************
; End DDE code
;**************************************


; The call below is for testing purposes only.
; It prevents the program from actually transmitting the
; data to the switch.  Leave this commented out, unless
; you are testing.

;readtest()


if iNumT == 0
	transmit "quit all^m"
	waitfor ">" forever
	exit
endif

for iIndexCIC = 1 upto iNumT
	;fputs 0 sPort[iIndexCIC]
endfor

for iIndexCIC = 1 upto iNumT
	for iIndexCIC2 = 1 upto 24
		sTemp = "add "
		strcat sTemp sCLLI
		strcat sTemp " "
		numtostr iCIC sTemp2 10
		strcat sTemp2 " "
		strcat sTemp sTemp2
		strcat sTemp "0 DTC "
		strcat sTemp sPort[iIndexCIC]
		strcat sTemp " "
		numtostr iIndexCIC2 sTemp2 10
		strcat sTemp sTemp2
		transmit sTemp
		transmit "^m"
		waitfor ">" forever
		iCIC ++
	endfor
     ; Removed below code do to issues where member#'s not matching cic#'s
	;if strcmp sSkip "s"
		;numtostr iCIC sTemp2 10
		;strrev sTemp2
		;if strncmp sTemp2 "79" 2
			;iCIC = iCIC + 4
		;endif
	;endif
endfor


; ******************** table c7trkmem here *************************

transmit "quit all^m"
waitfor ">" forever
transmit "table c7trkmem^m"
waitfor ">" forever

strtonum sCICC7 iCIC 10

sdlginput "Enter 1st CIC #" "Enter Number" sMEM DEFAULT
if strcmp sNumT "end"
	exit
endif
strtonum sMEM iMEM 10


for iIndexCIC = 1 upto iNumT
	for iIndexCIC2 = 1 upto 24
		sTemp = "add "
		strcat sTemp sCLLI
		strcat sTemp " "
		numtostr iCIC sTemp2 10
		strcat sTemp2 " "
		strcat sTemp sTemp2
		strcat sTemp " "
		numtostr iMEM sTemp2 10
		strcat sTemp sTemp2
		transmit sTemp
		transmit "^m"
		waitfor ">" forever
		iMEM ++
		iCIC ++
	endfor
	if strcmp sSkip "s"
		numtostr iMEM sTemp2 10
		strrev sTemp2
		if strncmp sTemp2 "79" 2
			iMEM = iMEM + 4
			;iCIC = iCIC +4
		endif
	endif
endfor


; ******************** switch to table amatkopt *******************

transmit "quit all^m"
waitfor ">" forever
transmit "table amatkopt^m"
waitfor ">" forever

set capture path "c:\"
set capture file "captest.txt"
fName="c:\captest.txt"
delfile fName
sTRKINFO = ""
sTGMU = ""
sRECORDCPN = ""
sRECORDCHN = ""

clear
capture on
sXMIT = "pos "
strcat sXMIT sCLLI
strcat sXMIT "^m"
transmit sXMIT
waitfor ">" forever
capture off

fopen 0 fName read text
sTemp = ""
fgets 0 sTemp
fgets 0 sTemp
if strfind sTemp "TUPLE NOT FOUND"	; Tuple not found, need to add tuple here
	sTemp = "add "
	strcat sTemp sCLLI
	strcat sTemp " trkinfo tgmu y y  $^m"
	transmit sTemp
	waitfor ">" forever


	statmsg sTemp


endif



fclose 0
delfile fname

; ************************** Process Findref CLLI? ************************

sTemp = ""
sdlginput "Process Findref CLLI?" "(y)es or (n)o:" sTemp DEFAULT

switch sTemp
	case "y"
		sTemp = sCLLI
		strcat sTemp "-FRC.txt"
		clear
		transmit "quit all^m"
		waitfor ">" forever
		set capture file sTemp
		capture on
		sTemp = "findref clli "
		strcat sTemp sCLLI
		strcat sTemp "^m"
		transmit sTemp
		waitfor ">" forever
		capture off
	endcase
endswitch

transmit "quit all^m"
waitfor ">" forever

statclear


endproc








proc test
	waitfor ">" forever
	transmit "n^m"
	waitfor ">" forever
	when target 1 resume reset
endproc

proc test1
	waitfor ">" forever
	transmit "y^m"
	waitfor ">" forever
endproc

proc test2
	when target 1 resume reset
endproc

proc test3
	waitfor ">" forever
	transmit "abort^m"
	waitfor ">" forever
	when target 1 resume reset
endproc

proc readtest
	delfile "c:\crazytest.txt"
	fopen 0 "c:\crazytest.txt" write text
	for iIndexCIC = 1 upto iNumT
		fputs 0 sPort[iIndexCIC]
	endfor
	fclose 0
	exit
endproc

What you care about in the last example are the DDE variables block at the top, and this from the middle...

Code:
;**************************************
; Code here for DDE input for DTC's
;**************************************

   iCol1 = 1                                    ;Column one
   iRow = 1                                     ;Start reading with row 1

   if ddeinit SystemVar "excel" "system"
      ;ddeexecute SystemVar "[FULL(TRUE)]"       ;Maximize the spreadsheet.
      if ddeinit LinkVar "excel" "sheet1"       ;Set up link to spreadsheet.
         while 1                                ;Loop forever.
            strfmt sRowCol "R%dC%d" iRow iCol1  ;Format request for data from current row, column 1
               ;sdlgmsgbox "Here" sRowCol stop ok iTemp
            dderequest LinkVar sRowCol szText   ;Read data from spreadsheet, current row, column 1
   ;sdlgmsgbox "Here" szText stop ok iTemp
   	strreplace szText "`n" ""
   	strreplace szText "`r" ""
   	;szText = "end"
            if strcmp szText "end"	        ;If cell contains the string exit
           ; sdlgmsgbox szText "Exitwhile" stop ok iTemp
               exitwhile                        ;Exit the while loop.
            else
               ;strfmt sRowCol "R%dC%d" iRow iCol2
               ;dderequest LinkVar sRowCol szText;Read data from spreadsheet, current row, column 2
               iNumT ++
               sPort[iNumT] = szText
            endif
            iRow++                              ;Increment row value
         endwhile
         ddeterminate LinkVar                   ;Break DDE link to spreadsheet.
         ddeterminate SystemVar                 ;Break DDE link to Excel.
      else
         errormsg "Couldn't establish DDE link to spreadsheet!"
      endif
   else
      errormsg "Couldn't establish DDE link to Excel!"
   endif


;**************************************
; End DDE code
;**************************************


[/code]
 
Oops, hit submit by accident, the upper code block should be two.

In my example, Aspect reads down a row of cells until it hits a cell with 'end' in it (no quotes.)

Then reads it in to a spreadsheet.

Knob's web-site was very helpful when I originally put this together. I just don't remember what the URL is.

The top block should have been:

Code:
string sIP
   string sMarket
   string sTemp
   string oldpass = "oldpassword^m"
   string newpass = "newpassword^m"
   

proc main
 
   ;integer iChoice
   set capture path "c:\SwitchAudit\"
   
   if fopen 0 "c:\switchlist.txt" READ TEXT        ;Open text file containing list of connections
      while not feof 0                             ;While data remains in the file
         fgets 0 sTemp                             ;Get entry from file
         strtok sIP sTemp "`t" 1
         strtok sMarket sTemp "`t" 1
    
     strcat sMarket ".txt"
    
     set capture file sMarket
    
         if not nullstr sMarket                       ;If entry is not blank
            connectmanual TELNET sIP                         ;Then dial it
            waitfor ">" forever
            transmit "username^m"
            waitfor ">" forever
            transmit oldpass
            waitfor ">" forever
            clear
            pause 2
            transmit "password^m"
            waitfor ">" forever
            transmit newpass
            waitfor ">" forever
            transmit newpass
            waitfor ">" forever
            transmit oldpass
            waitfor ">" forever
            transmit "logout^m"
            
            ;sdlgmsgbox "" sMarket NONE OK iChoice
            
            
            
         endif
      endwhile
   endif
   fclose 0                                        ;Close data file
endproc

And then:

Code:
;**************************************
; Build trunk groups in a DMS 100 based
; switch.  CLLI tuple must already
; exist, and the number of trunks
; should already reflect the final
; amount.
;    By:  Kevin Smith
;    6/3/05
; DDE code derived from samples at
; [URL unfurl="true"]www.aspectscripting.com[/URL]
;**************************************
; Removed code that skipped trkmember#'s
;**************************************

;**************************************
; Declare DDE variables.
;**************************************

long LinkVar, SystemVar                      ;Variables containing DDE Id's.
string szText                                ;Text read from DDE link to Excel.
integer iRow, iCol1                          ;Row and column variables
string sRowCol                               ;Holds request for row and column

;**************************************
; Main procedure below
;**************************************

integer iNumT
integer iIndexCIC
string sPort[90]

proc main

string sSkip,fName,sTRKINFO,sTGMU,sRECORDCPN,sRECORDCHN,sXMIT
string sNumT
string sStartCIC
string sTemp
string sTemp2
string sTemp3

string sCLLI
string sMEM
string sCICC7

integer iMEM
integer iIgnore
integer iIndexCIC2
integer iCIC

when target 0 "DMO REJECTED" MATCHCASE call test suspend
when target 1 "ENTER Y TO CONFIRM" MATCHCASE call test1
when target 2 "*** ERROR - INCONSISTENT DATA ***" MATCHCASE call test suspend
when target 3 "NO COMMAND IN LINE" call test2 suspend
when target 4 "*** ERROR ***" call test3 suspend

; ********** start at table trkmem ***************

usermsg "Ensure table CLLI has been modified to match new total number of trunks.`nTQ each carrier.`nVerifiy starting TCIC."

transmit "table trkmem^m"
waitfor ">" forever

sdlginput "CLLI" "Enter CLLI" sCLLI DEFAULT

iNumT = 0


sdlginput "(s)kip or (n)oskip?" "Skip/Noskip" sSkip DEFAULT

if strcmp sSkip "end"
    exit
endif

switch sSkip
    case "s"
    endcase
    case "n"
    endcase
    default
        sdlgmsgbox "" "Only s or n allowed" stop ok iIgnore
        exit
    endcase
endswitch

sdlginput "Starting Trunk Member #" "Mem#" sStartCIC DEFAULT
sCICC7 = sStartCIC

if strcmp sStartCIC "end"
    exit
endif

strtonum sStartCIC iIndexCIC 10

strrev sStartCIC

;if strcmp sSkip "s"
;    if strncmp sStartCIC "79" 2
;        sdlgmsgbox "Error" "Can't start at x97" stop ok iIgnore
;        exit
;    endif
;endif

strrev sStartCIC
strtonum sStartCIC iCIC 10


sTemp= "(S)kip or (N)oskip: "
sTemp3 = sSkip
strinsert sTemp3 sTemp 0

sTemp = "Starting CIC: "
strinsert sStartCIC sTemp 0


;**************************************
; Code here for DDE input for DTC's
;**************************************

   iCol1 = 1                                    ;Column one
   iRow = 1                                     ;Start reading with row 1

   if ddeinit SystemVar "excel" "system"
      ;ddeexecute SystemVar "[FULL(TRUE)]"       ;Maximize the spreadsheet.
      if ddeinit LinkVar "excel" "sheet1"       ;Set up link to spreadsheet.
         while 1                                ;Loop forever.
            strfmt sRowCol "R%dC%d" iRow iCol1  ;Format request for data from current row, column 1
               ;sdlgmsgbox "Here" sRowCol stop ok iTemp
            dderequest LinkVar sRowCol szText   ;Read data from spreadsheet, current row, column 1
   ;sdlgmsgbox "Here" szText stop ok iTemp
       strreplace szText "`n" ""
       strreplace szText "`r" ""
       ;szText = "end"
            if strcmp szText "end"            ;If cell contains the string exit
           ; sdlgmsgbox szText "Exitwhile" stop ok iTemp
               exitwhile                        ;Exit the while loop.
            else
               ;strfmt sRowCol "R%dC%d" iRow iCol2
               ;dderequest LinkVar sRowCol szText;Read data from spreadsheet, current row, column 2
               iNumT ++
               sPort[iNumT] = szText
            endif
            iRow++                              ;Increment row value
         endwhile
         ddeterminate LinkVar                   ;Break DDE link to spreadsheet.
         ddeterminate SystemVar                 ;Break DDE link to Excel.
      else
         errormsg "Couldn't establish DDE link to spreadsheet!"
      endif
   else
      errormsg "Couldn't establish DDE link to Excel!"
   endif


;**************************************
; End DDE code
;**************************************


; The call below is for testing purposes only.
; It prevents the program from actually transmitting the
; data to the switch.  Leave this commented out, unless
; you are testing.

;readtest()


if iNumT == 0
    transmit "quit all^m"
    waitfor ">" forever
    exit
endif

for iIndexCIC = 1 upto iNumT
    ;fputs 0 sPort[iIndexCIC]
endfor

for iIndexCIC = 1 upto iNumT
    for iIndexCIC2 = 1 upto 24
        sTemp = "add "
        strcat sTemp sCLLI
        strcat sTemp " "
        numtostr iCIC sTemp2 10
        strcat sTemp2 " "
        strcat sTemp sTemp2
        strcat sTemp "0 DTC "
        strcat sTemp sPort[iIndexCIC]
        strcat sTemp " "
        numtostr iIndexCIC2 sTemp2 10
        strcat sTemp sTemp2
        transmit sTemp
        transmit "^m"
        waitfor ">" forever
        iCIC ++
    endfor
     ; Removed below code do to issues where member#'s not matching cic#'s
    ;if strcmp sSkip "s"
        ;numtostr iCIC sTemp2 10
        ;strrev sTemp2
        ;if strncmp sTemp2 "79" 2
            ;iCIC = iCIC + 4
        ;endif
    ;endif
endfor


; ******************** table c7trkmem here *************************

transmit "quit all^m"
waitfor ">" forever
transmit "table c7trkmem^m"
waitfor ">" forever

strtonum sCICC7 iCIC 10

sdlginput "Enter 1st CIC #" "Enter Number" sMEM DEFAULT
if strcmp sNumT "end"
    exit
endif
strtonum sMEM iMEM 10


for iIndexCIC = 1 upto iNumT
    for iIndexCIC2 = 1 upto 24
        sTemp = "add "
        strcat sTemp sCLLI
        strcat sTemp " "
        numtostr iCIC sTemp2 10
        strcat sTemp2 " "
        strcat sTemp sTemp2
        strcat sTemp " "
        numtostr iMEM sTemp2 10
        strcat sTemp sTemp2
        transmit sTemp
        transmit "^m"
        waitfor ">" forever
        iMEM ++
        iCIC ++
    endfor
    if strcmp sSkip "s"
        numtostr iMEM sTemp2 10
        strrev sTemp2
        if strncmp sTemp2 "79" 2
            iMEM = iMEM + 4
            ;iCIC = iCIC +4
        endif
    endif
endfor


; ******************** switch to table amatkopt *******************

transmit "quit all^m"
waitfor ">" forever
transmit "table amatkopt^m"
waitfor ">" forever

set capture path "c:\"
set capture file "captest.txt"
fName="c:\captest.txt"
delfile fName
sTRKINFO = ""
sTGMU = ""
sRECORDCPN = ""
sRECORDCHN = ""

clear
capture on
sXMIT = "pos "
strcat sXMIT sCLLI
strcat sXMIT "^m"
transmit sXMIT
waitfor ">" forever
capture off

fopen 0 fName read text
sTemp = ""
fgets 0 sTemp
fgets 0 sTemp
if strfind sTemp "TUPLE NOT FOUND"    ; Tuple not found, need to add tuple here
    sTemp = "add "
    strcat sTemp sCLLI
    strcat sTemp " trkinfo tgmu y y  $^m"
    transmit sTemp
    waitfor ">" forever


    statmsg sTemp


endif



fclose 0
delfile fname

; ************************** Process Findref CLLI? ************************

sTemp = ""
sdlginput "Process Findref CLLI?" "(y)es or (n)o:" sTemp DEFAULT

switch sTemp
    case "y"
        sTemp = sCLLI
        strcat sTemp "-FRC.txt"
        clear
        transmit "quit all^m"
        waitfor ">" forever
        set capture file sTemp
        capture on
        sTemp = "findref clli "
        strcat sTemp sCLLI
        strcat sTemp "^m"
        transmit sTemp
        waitfor ">" forever
        capture off
    endcase
endswitch

transmit "quit all^m"
waitfor ">" forever

statclear


endproc








proc test
    waitfor ">" forever
    transmit "n^m"
    waitfor ">" forever
    when target 1 resume reset
endproc

proc test1
    waitfor ">" forever
    transmit "y^m"
    waitfor ">" forever
endproc

proc test2
    when target 1 resume reset
endproc

proc test3
    waitfor ">" forever
    transmit "abort^m"
    waitfor ">" forever
    when target 1 resume reset
endproc

proc readtest
    delfile "c:\crazytest.txt"
    fopen 0 "c:\crazytest.txt" write text
    for iIndexCIC = 1 upto iNumT
        fputs 0 sPort[iIndexCIC]
    endfor
    fclose 0
    exit
endproc
 
thanks for the info i started working with the first script and its working great. however some of these ip address have a unique password and also i need to save the name thats associated with these ip's so i can easilly id them here is an ex.of my spreadsheet.

name ipaddress username password

MAV1131 10.190.4.209 rbs rbs
MAV1137 10.190.4.217 rbs rbs1137
MAV1143 10.190.4.225 rbs rbs
MAV1175 10.190.4.233 rbs rbs1175

i guess i can do i vlook once i get the info in excel but i need a way to send the different password
 
Post what you've got so far. Once you can read the values into a variable, you can do anything you want to them.
 
this is what i have so for i only need the vswr result

string sIP
string sMarket
string sTemp


proc main
integer iDay, iMonth, iYear, iHour, iMin, iSec
string sFileName
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sFileName "%d%02d%02d" iYear iMonth iDay
strcat sFileName "_vswr_ALL.txt"
set capture file sFileName
;integer iChoice
set capture path "c:\capture\_vswr_ALL.txt"

if fopen 0 "c:\vswr\testing.txt" READ TEXT ;Open text file containing list of connections
while not feof 0 ;While data remains in the file
fgets 0 sTemp ;Get entry from file
strtok sIP sTemp "`t" 1
strtok sMarket sTemp "`t" 1

strcat sMarket "_vswr_ALL.txt"

set capture file sMarket

if not nullstr sMarket ;If entry is not blank
connectmanual TELNET sIP ;Then dial it
waitfor "username: "
transmit "rbs^M"
waitfor "Password: "
transmit "rbs^M"
waitfor "$"

transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
capture on
waitfor "[listing]"

capture off
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
capture on
waitfor "[listing]"

capture off
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_2_dev_20 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_6_dev_21 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_10_dev_22 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "logout^m"
;sdlgmsgbox "" sMarket NONE OK iChoice



endif
endwhile
endif
fclose 0 ;Close data file
endproc

this is the result
i only need the vswr results i am still getting everything no matter where i put the capture on


$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 18.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 18.5[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 20.0[dB]
$ lhsh 001200/port_2_dev_20 fui get vswr
lhsh: failed to connect to 001200/port_2_dev_20
$
 
If I remember correctly, that's one issue of capturing, you get more then you want. What I usually did was to capture everying to a text file then read the file back in once I was done collecting all of the data.

Change your capture file name to a name that makes sense to you (equipment name, whatever). Send them all to a directory to just hold these files. Then parse them back in after. Then output them (excel or .csv, or whatever format) with your file name/equipment name, and whatever follow on data you want.
 
To add on to what kodr said, capture is going to give you everything that is on the screen essentially. If you are looking for just a single line, you can try using rget instead. Keep in mind you may need to use a couple rget commands to grab the line you need depending on how the other system echoes back what you type. Also the output will not be displayed on the screen if rget grabs it.

 
ok so i am still not getting this thing to work i can read from and login to a (ip.txt) list but i cant get it to read the username and password this is what i am working with so for


string sIP
string sMarket
string sTemp
string sUsername
string sPassword

proc main
integer iDay, iMonth, iYear, iHour, iMin, iSec
string sFileName
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sFileName "%d%02d%02d" iYear iMonth iDay
strcat sFileName "_vswr_ALL.txt"
set capture file sFileName
;integer iChoice
set capture path "c:\capture\_vswr_ALL.txt"

if fopen 0 "c:\vswr\brptrncip.txt" READ TEXT ;Open text file containing list of connections

while not feof 0 ;While data remains in the file
fgets 0 sTemp ;Get entry from file
strtok sIP sTemp "`t" 1
strtok sMarket sTemp "`t" 1

strcat sMarket "_vswr_ALL.txt"

set capture file sMarket

if not nullstr sMarket ;If entry is not blank
connectmanual TELNET sIP ;Then dial it
Waitfor "username"
if fopen 1 "c:\vswr\brptrncusername.txt" READ TEXT ;Open text file containing list of usernames
while not feof 1 ;While data remains in the file
fgets 1 sTemp ;Get entry from file
strtok sUsername sTemp "`t" 2 ;write entry from file

if fopen 2 "c:\vswr\brptrncpassword.txt" READ TEXT ;Open text file containing list of passwords
while not feof 2 ;While data remains in the file
fgets 2 sTemp ;Get entry from file
strtok sPassword sTemp "`t" 3 ;write entry from file
strtok sMarket sTemp "`t" 3


waitfor "DB"

transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
capture on
waitfor "DB"

capture off
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
capture on
waitfor "DB"

capture off
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_2_dev_20 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_6_dev_21 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "lhsh 001200/port_10_dev_22 fui get vswr^m"

waitfor "[dB]"
capture on
capture off
transmit "logout^m"
;sdlgmsgbox "" sMarket NONE OK iChoice



endwhile
endif
endwhile
fclose 0 ;Close data file
endif
endif
fclose 0 ;Close data file
endwhile
endif
endproc

 
these are the two script i have been working on i need to completely automate any one

;This script will prompt for the IP of a Node-B, telnet to the Node-B, and get VSWR values.


proc main


string szipaddress
string szusername
string szpassword


sdlginput "IP ADDRESS" "Enter IP Address" szipaddress

connectmanual telnet szipaddress


waitfor "username: "
sdlginput "User Name" "Enter User Name" szusername
transmit szusername
transmit "^m"

waitfor "Password: "
sdlginput "Password" "Enter Password" szpassword
transmit szpassword
transmit "^m"


waitfor "$"
transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "$"
waitfor "$"
transmit "lhsh 001200/port_2_dev_22 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_6_dev_23 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_10_dev_24 fui get vswr^m"
waitfor "$"

transmit "lhsh 001200/port_0_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_0_dev_11 fui get vswr^m"
waitfor "$"



transmit "lhsh 001200/port_4_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_4_dev_11 fui get vswr^m"
waitfor "$"





transmit "lhsh 001200/port_8_dev_3 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_4 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_5 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_6 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_7 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_8 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_9 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_8_dev_11 fui get vswr^m"


waitfor "$"
transmit "lhsh 001200/port_2_dev_20 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_6_dev_21 fui get vswr^m"
waitfor "$"
transmit "lhsh 001200/port_10_dev_22 fui get vswr^m"




waitfor "$"


endproc




**********************************************************************************************************************




;Recorded script. Editing may be required.

proc main

string szcellnumber
string szipaddress
string szdevnumber

sdlginput "CELL NUMBER" "Enter Cell Number" szcellnumber
sdlginput "IP ADDRESS" "Enter IP Address" szipaddress

connectmanual telnet szipaddress


waitfor "username: " ;On first attempt, script sends rbs+site number
transmit "rbs"
transmit szcellnumber
transmit "^m"

waitfor "Password: "
transmit "rbs"
transmit szcellnumber
transmit "^m"


;IF login/password is NOT rbs+site number, script will re-telnet and send login/password
;of rbs/rbs

waitfor "Welcome to OSE Shell" 3 ;waits for 3 seconds
if FAILURE
connectmanual telnet szipaddress
waitfor "username: "
transmit "rbs^m"
waitfor "Password: "
transmit "rbs^m"
endif



waitfor "$" 3 ;waits for 3 seconds
if FAILURE ;If still not good, send usermsg to check RBS Number and/or IP Address
usermsg "Check RBS Number and IP"
endif





transmit "lhsh 001200 ps port_0*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelPort2
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_0_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***ALPHA First Carrier***"



LabelPort2:
transmit "lhsh 001200 ps port_2*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelPort4
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_2_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***ALPHA Second Carrier***"


LabelPort4:
transmit "lhsh 001200 ps port_4*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelPort6
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_4_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***BETA First Carrier***"


LabelPort6:
transmit "lhsh 001200 ps port_6*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelPort8
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_6_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***BETA Second Carrier***"



LabelPort8:
transmit "lhsh 001200 ps port_8*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelPort10
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_8_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***GAMMA First Carrier***"

LabelPort10:
transmit "lhsh 001200 ps port_10*^m"
waitfor "Invalid" 2
if SUCCESS
goto LabelCleanUp
endif
sdlginput "Dev Number For fu" "Enter Dev Number" szdevnumber
transmit "lhsh 001200/port_10_dev_"
transmit szdevnumber
transmit " fui get vswr^m"
waitfor "[db]"
termwrites " ***GAMMA Second Carrier***"

LabelCleanUp:
transmit "exit^m"
halt


endproc



 
ok i have figure out most of it but my output is all screw up here is what i have


THIS IS MY SCRIPT

proc main
string sLine, sTemp1, sTemp2, sTemp3, sTemp4, sTemp5

fopen 0 "C:\node B\test.txt" READ TEXT ;Open our data file
while not feof 0 ;loop While the file still has data
fgets 0 sLine ;Read a line of data
strtok sTemp1 sLine "`t" 1 ;Get the first field ip address
strtok sTemp2 sLine "`t" 1 ;Get the second field username
strtok sTemp3 sLine "`t" 1 ;Get the third field password
strtok sTemp4 sLine "`t" 1 ;Get the fourth field site name
strtok sTemp5 sLine "`t" 1 ;Get the 5th field site name
termwrites sTemp4 ;site name
connectmanual TELNET sTemp1 ;Then telnet it

transmit "^M"
waitfor "username:"
transmit STemp2 ;send username
transmit "^M"

waitfor "password:"
transmit sTemp3 ;send password
transmit "^M"
waitfor "Welcome to OSE Shell OSE4.6.1" 3

if FAILURE
connectmanual telnet sTemp1
waitfor "username:"
transmit sTemp2
transmit "^M"
waitfor "Password: "
transmit sTemp2
transmit sTemp5
transmit "^M"
endif

transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "vswr:"
if SUCCESS
goto LabelPort1




transmit "lhsh 001200/port_2_dev_20 fui get vswr^m"
waitfor "vswr:"
if SUCCESS
goto LabelPort2

LabelPort1:


transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "vswr:"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "vswr:"
termwrites " ***1900MHZ First Carrier***"
endif

LabelPort2:


transmit "lhsh 001200/port_6_dev_21 fui get vswr^m"
waitfor "vswr:"

transmit "lhsh 001200/port_10_dev_22 fui get vswr^m"
waitfor "vswr:"
transmit "^M"
termwrites " ***850MHZ Second Carrier***"






fclose 0
endif
endwhile

endproc


THE RESULTS


CTU2043username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 19.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 19.7[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: ***1900MHZ First Carrier*** 21.3[dB]
$ lhsh 001200/port_6_dev_21 fui get vswr
vswr: 24.4[dB]
$ lhsh 001200/port_10_dev_22 fui get vswr
vswr: ***850MHZ Second Carrier*** 25.7[dB]
$
$



MY RESULT SHOULD LOOK LIKE THIS

CTU2043
username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 19.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 19.7[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 21.3[dB]
***1900MHZ First Carrier***
$ lhsh 001200/port_6_dev_21 fui get vswr
vswr: 24.4[dB]
$ lhsh 001200/port_10_dev_22 fui get vswr
vswr: 25.7[dB]
***850MHZ Second Carrier***
$



 
With just a quick glance, my guess would be that termwrites executes much faster then transmit (some telnet sessions, what you type and gets sent to the far end, echo's back to your terminal before being displayed.)

I would put a pause 1 or pause 2 (one or two second pause) before any termwrites statement, and see if that makes a difference.
 
Also, add a line below this line:

termwrites sTemp4 ;site name
termwrites "^m"

See if that keeps username from ending up directly behind the site name.

You should investigate strcat also. It lets you concatenate two strings together (like a command and ^m). In my opinion, it makes your code a little easier to read, once your programs start to become multi thousand line monstrosities.
 
awesome made the changes and its looking much better

however i am stil left with 2 issues
1 its not looping thru all the ipaddress (error 5) and 2 its overwriting the site name here is the output
no matter where i put the termwrite for username it gets overwritten

username: rbs
password:
Welcome to OSE Shell OSE4.6.1.
$ lhsh 001200/port_0_dev_8 fui get vswr
vswr: 19.3[dB]
$ lhsh 001200/port_4_dev_9 fui get vswr
vswr: 19.7[dB]
$ lhsh 001200/port_8_dev_10 fui get vswr
vswr: 21.1[dB]
$ ***1900MHZ First Carrier***
lhsh 001200/port_6_dev_21 fui get vswr
$ vswr: 24.7[dB]
$ lhsh 001200/port_10_dev_22 fui get vswr
vswr: 25.6[dB]
$ ***850MHZ Second Carrier***
$
 
got it thamks for your help its now looking much better plus its going thru all my ip address

proc main
string sLine, sTemp1, sTemp2, sTemp3, sTemp4, sTemp5

fopen 0 "C:\node B\calvin1.txt" READ TEXT ;Open our data file
while not feof 0 ;loop While the file still has data
fgets 0 sLine ;Read a line of data
strtok sTemp1 sLine "`t" 1 ;Get the first field ip address
strtok sTemp2 sLine "`t" 1 ;Get the second field username
strtok sTemp3 sLine "`t" 1 ;Get the third field password
strtok sTemp4 sLine "`t" 1 ;Get the fourth field site name
strtok sTemp5 sLine "`t" 1 ;Get the 5th field site name
connectmanual TELNET sTemp1 ;Then telnet it

waitfor "username:"
transmit STemp2 ;send username
transmit "^M"

waitfor "password:"
transmit sTemp3 ;send password
transmit "^M"
waitfor "Welcome to OSE Shell OSE4.6.1" 3
pause 1

if FAILURE
connectmanual telnet sTemp1
waitfor "username:"
transmit sTemp2
transmit "^M"
waitfor "Password: "
pause 1
transmit sTemp2
transmit sTemp5
transmit "^M"
endif
termwrites sTemp4 ;site name
termwrites "^m"
transmit "^M"
transmit "lhsh 001200/port_0_dev_8 fui get vswr^m"
waitfor "[db]"
transmit "lhsh 001200/port_4_dev_9 fui get vswr^m"
waitfor "[db]"
transmit "lhsh 001200/port_8_dev_10 fui get vswr^m"
waitfor "[db]"
waitfor ""
pause 1
transmit "^M"
termwrites " *** 1900 MHZ First carrier ***"
termwrites "^m"
pause 1


transmit "^M"
endwhile

fclose 0

endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top