Link to home
Start Free TrialLog in
Avatar of GlobaLevel
GlobaLevelFlag for United States of America

asked on

vbscript - issue with script.. line 31 bad file mode..

getting bad file mode on this....

need copy and paste the <asp...
then
the html code

then paste the </asp:panel....

repeat...
dim objArgs, objFile1, objFile2, FileStream1,FileStream2, i , slIN1, sLINE2, j, sline3, sline4, sline5, k, allLines

Set objArgs = Wscript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFile1 = objFSO.GetFile(objArgs(0))
'Set objFile2 = objFSO.GetFile(objArgs(1))
Set FileStream1 = objFSO.OpenTextFile("D:\Desiition\design_1\index.htm")
Set FileStream2 = objFSO.OpenTextFile("C:\Documentstings\NBDFFR\PRGS\VBSCRIPT\test_panel_web.txt")



For i = 1 to 50
    ' READ THE DRIVE FILE IN...
    Set FileStream1 = objFSO.OpenTextFile("D:\Desiition\design_" & i & "\index.htm")
   
    sLine1 = FileStream1.ReadLine()
    

    ' READ THE ASP:panel CODE IN...
     ' sline2 = "this"
 
     sline2 = "<asp:Panel ID=""Panel"" " & i & " runat=""server"" Height=""1599px"">"

    sline3 = "</asp:Panel>"
    sline4 = ""
    sline5 = ""

    

   Filestream2.writeline Sline1
   ' GOTO NEXT LINE IN FILESTREAM 2 AND PASTE..
   Filestream2.writelIne sline2
 ' GOTO NEXT LINE IN FILESTREAM 2 AND PASTE...
   Filestream2.writeline sline3
 ' GOTO NEXT LINE IN FILESTREAM 2 AND PASTE...
   Filestream2.writeline sline4
 ' GOTO NEXT LINE IN FILESTREAM 2 AND PASTE...
   Filestream2.writeline sline5

   


Next

msgbox("complete")

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use the second parameter of OpenTextFile

1=ForReading - Open a file for reading. You cannot write to this file. (readonly)
2=ForWriting - Open a file for writing (create)
8=ForAppending - Open a file and write to the end of the file (append)

Set FileStream2 = objFSO.OpenTextFile("C:\Documentstings\NBDFFR\PRGS\VBSCRIPT\test_panel_web.txt",2)
Avatar of GlobaLevel

ASKER

getting closer...but its not reading in the whole html file...
giving me this...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 1 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 2 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 3 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 4 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 5 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 6 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 7 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 8 runat="server" Height="1599px">
</asp:Panel>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<asp:Panel ID="Panel" 9 runat="server" Height="1599px">
</asp:Panel>

its stops readin in the html file after it sees the space..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
      <titl
This is not the bad file mode issue anymore.
It's logic - basically you have no loop, there should be a test for EOF, but you have it hardcoded to loop through 50 lines... (I think if I read correctly)