Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 681

File staying open after script executes

$
0
0
I have a script that will fire once an hour. In this script txt files are created. The next time the script fires, it may or may not create another file (with the same name). However I am getting an permission denied error. I believe this to be because the original file is still open even though the script has finished executing. I can't figure out why the txt file will still be open for editing when I have closed it and cleared out all of the variables from memory. Any help at all would be appreciated. My code for creating the file is below:

Code:

If (InStr(ErrorCode,"already exists!")=0) AND (Len(ErrorCode)>0) AND (InStr(ErrorCode,"Invalid Offer!")=0) Then
                                'WRITING SOAPMessage to Text File so we can see what the error is
                                logfile.writeline OrderID & " - Unknown Error See Order Folder for Details"
                                strOutputFile2="C:/LogFiles/" & Cust & "/OrderFiles/"& OrderID &".txt"
                                'wscript.echo strOutputFile2
                                Dim OrderFSO, OrderFile
                                Set OrderFSO = CreateObject("Scripting.FileSystemObject")
                                Set OrderFile = OrderFSO.CreateTextFile(strOutputFile2, TRUE)
                                OrderFile.writeLine (SOAPMessage)
                                orderFile.writeLine "-----------------------"
                                OrderFile.writeLine "Response: " & xmlhttp.status
                                OrderFile.WriteLine xmlhttp.responseText
                                OrderFile.Close()
                                Set strOutputFile2 = nothing
                                Set OrderFile = Nothing
                                Set OrderFSO = Nothing
                        End If
                End If

Can anyone see anything that would keep the txt file open even after the script is done executing?

Viewing all articles
Browse latest Browse all 681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>