title: subscript out of range error in vbscript
body: <p>Can someone look at the below script and tell me why it's throwing this error subscript out of range error in vbscript ..In the text file there are two entries it writes to the file correctly but then it throws an error while exiting the loop so it never calls the other function..I think it's trying to run 3 times but there are just 2 entries in the text file</p>
  
  <pre><code>The text file is in this format
  
      Format.css Shared
      Design.css Shared
  
  
  Dim strInputPath1
  Dim txsInput1,txsOutput
  Dim FSO
  Dim Filename
  
  Set FSO = CreateObject("Scripting.FileSystemObject")
  strOutputPath = "C:\txt3.txt"
  Set txsOutput = FSO.CreateTextFile(strOutputPath)
  
  Set re = New RegExp
  re.Pattern = "\s+"
  re.Global  = True
  
  Set f = FSO.OpenTextFile("C:\Users\spadmin\Desktop\Main\combination.txt")
  Do Until f.AtEndOfStream
    tokens = Split(Trim(re.Replace(f.ReadLine, " ")))
    extension = Split(tokens(0),".")
    strInputPath1 =  "C:\inetpub\wwwroot\Test\files\" &amp; tokens(1) &amp; "\" &amp; extension(1) &amp; "\" &amp; tokens(0) 
    Set txsInput1 = FSO.OpenTextFile(strInputPath1, 1)
    WScript.Echo strInputPath1
    txsOutput.Writeline txsInput1.ReadAll
  
  Loop
  WScript.Echo "Calling"
  
  txsInput1.Close
  txsOutput.Close
  f.Close
  Call CreateCSSFile()
  
  
  ''''''''''''''''''''''''''''''''''''
  ' Merge Css Files
  ''''''''''''''''''''''''''''''''''''
  Sub CreateCSSFile()
   WScript.Echo "Called"
  
   Dim FilenameCSS
  
   Dim strInputPathCSS
   Dim txsInputCSS,txsOutputCSS
   Dim FSOCSS
  
  
  Set FSOCSS = CreateObject("Scripting.FileSystemObject")
  strOutputPathCSS = "C:\txt4.txt"
  Set txsOutputCSS = FSOCSS.CreateTextFile(strOutputPath)
  
  Set re = New RegExp
  re.Pattern = "\s+"
  re.Global  = True
  
  Set fCSS = FSOCSS.OpenTextFile("C:\Users\spadmin\Desktop\TestingTheWebService\combination.txt")
  Do Until fCSS.AtEndOfStream
    tokensCSS = Split(Trim(re.Replace(fCSS.ReadLine, " ")))
    extensionCSS = Split(tokensCSS(0),".")
    strInputPathCSS =  "C:\inetpub\wwwroot\EpsShared\c\" &amp; tokensCSS(1) &amp; "\" &amp; extensionCSS(1) &amp; "\" &amp; tokensCSS(0) 
    Set txsInputCSS = FSOCSS.OpenTextFile(strInputPathCSS, 1)
    txsOutputCSS.Writeline txsInputCSS.ReadAll
  
  Loop
  fCSS.Close
  txsInputCSS.Close
  txsOutputCSS.Close
  Set FSOCSS = Nothing
  End Sub
  </code></pre>