Hi all,
Is it possible to get VB to open a file within another "open"?
Basically, i'm trying to do this:
What's happening is that I'm trying to download a file, open it, replace one line, and save it to a different file (this tequnique was taught to me here, for editing files).Code:Dim FF as integer Dim FFF as integer Dim NewVal as string FF = FreeFile() FFF = FreeFile() Open "C:\text.txt" for input as #FF While not EOF(FF) Input #FF, NewVal Open "C:\Testoutput.txt" for output as #FFF Write #FFF, NewVal Close #FFF Wend Close #FF
The problem is that if I put that open script within the first one, I get a "File already open" error. Other problems I'm having are (the file I'm trying to open is a webpage downloaded via the internet BTW) that I'm getting some layout / syntax errors.. Maybe it's due to there being " marks in the htm file that was downloaded? Is there any way to get allow it to read these as " marks and not operators for the system?
Also, the find-replace script that I'm using:
Basically I'm trying to remove the background from the webpage. The problem is that there are lots of other commands after that one, and this command is removing all of them.. I've tried lots of different things but is there any way to just pick a string, then a changable variable, then a string? I.E.Code:SnipVal = Mid(NewVal, 1, 55) ' If SnipVal = "Body {background-color: #000000; background-image: url(" Then ' NewVal = "Body {background-color: #000000;" ' End If
Sorry if that seemed confusing.. I'm hoping that someone can help me on one or more issuesCode:If SnipVal = "Body {background-color: #000000; background-image: url(<VariableHereToCoverAnyTextLength>) *more HTML commands here* then Dostuff end if
Thanks ^_^





Reply With Quote