home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,959 of 68,980   
   davicho rivas to All   
   SCRIPT INVALID CHARACTER SECURECRT   
   05 Oct 22 20:04:38   
   
   From: davicho981@gmail.com   
      
   Hi all,   
      
   I am using a script to be able to initialize sessions in secure crt but I have   
   an error when executing the script:   
      
   #$language = "VBScript"   
   #$interface = "1.0"   
      
   crt.Screen.Synchronous = True   
      
   Main   
   Sub Main()   
      
       Const ForReading = 1, ForWriting = 2, ForAppending = 8   
       'To define which line to start   
       Const StartLine = 1   
       'To define file system object, and related parameters   
       'fso, file1 is to define the file system   
       'line store the information of one NE in one line   
       'neinfo stores the line into array   
       'LineIndex store the number of the lines   
       Dim fso, file1, line, neinfo, LineIndex   
       'Define the access mode to the routers   
       Dim to_save, to_conf, to_check   
      
       to_check = 1   
       to_save = 0   
       to_conf = 0   
       'open file all.csv, to read line by line later   
       set fso = CreateObject("Scripting.FileSystemObject")   
       set file1 = fso.openTextFile("D:\David\Informes_y_Documentos   
   CLASS\MEMORIES\Data\AutomatizacionSecureCRT\all\all.csv", ForReading, False)   
      
       ' according to the constant Startline, read the file until the startline   
       if Startline > 1 then   
           for LineIndex = 1 to StartLine-1   
               line = file1.readline   
           next   
       end if   
      
       'Read line by line for the document, and for each line, login in the the   
   NE represented and do the related activity   
       do while file1.AtEndofStream <> True   
      
           ' read one line   
           line = file1.readline   
           LineIndex = LineIndex +1   
           ' Sperate the information and put into an array NeInfo   
           NeInfo = split (line, ",")   
      
           crt.Screen.WaitForString "#"   
      
           ' login to the device use ssh or telnet, the command line is different   
           if NEInfo(3) = "ssh" then   
                   crt.Screen.Send NeInfo(3) & " " & NeInfo(4) & "@" & NeInfo(2)   
   & vbCr   
               else   
                   crt.Screen.Send NeInfo(3) & " " & NeInfo(2) & vbCr   
                   crt.Screen.WaitForString "sername:"   
                   crt.Screen.Send NeInfo(4) & vbCr   
           end if   
      
           ' If the router is login for the first time, the solaris system need   
   to confirm to save the password information. Here to judge.   
           Dim SwitchKey   
      
           SwitchKey=crt.Screen.WaitForStrings("(yes/no)?","assword:",60)   
      
           Select case SwitchKey   
               case 1   
                crt.Screen.Send "yes" & vbCr   
                crt.Screen.WaitForString "assword:"   
                crt.Screen.Send NEinfo(5) & vbCr   
      
               case 2   
                crt.Screen.Send NEinfo(5) & vbCr   
           End Select   
      
           'To find out the router name for future use   
           dim strResult, strline   
           strResult = crt.Screen.ReadString (">")   
           strline = split (strResult, "<")   
      
           ' Temporarily not pause screen   
           crt.screen.send "screen 0 temp" & vbCr   
      
           if to_check = 1 then   
               'crt.Screen.WaitForStrING  ">"   
               crt.Screen.WaitForStrING  Strline(1) & ">"   
               crt.Screen.Send "display clock" & vbCr   
           end if   
      
           if to_conf = 1 then   
               'crt.Screen.WaitForStrING  ">"   
               crt.Screen.WaitForStrING  Strline(1) & ">"   
               crt.screen.send "" & vbCr   
               crt.Screen.WaitForStrING  Strline(1) & ">"   
               crt.screen.send "system-view" & vbCr   
               crt.Screen.WaitForStrING  "]"   
               crt.Screen.Send "dis this" & vbCr   
      
               crt.Screen.WaitForStrING  "]"   
               crt.Screen.Send "return" & vbCr   
           end if   
      
           if to_save = 1 then   
               crt.Screen.WaitForStrING  ">"   
               crt.Screen.Send "save" & vbCr   
               crt.Screen.WaitForStrING  "[Y/N]"   
               crt.Screen.Send "y" & vbCr   
           end if   
      
           crt.Screen.WaitForStrING  Strline(1) & ">"   
           crt.Screen.Send "quit" & vbCr   
      
           ' one router completed, continue to next router until file empty   
       loop   
   end sub   
      
      
   The error tells me that there is an invalid character on line 9, but I search   
   and can't find the error, can you help me please   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca