We have an application that runs every 15 minutes that brings up a browser window, runs it's script and closes the window afterwards. It worked fine in IE6, however after upgrading to IE8, it prompts the message "The webpage you are viewing is trying to close the window". It does not close and these messages and windows build up over time. Is there any way to stop that message from appearing or if need be, adding something to our script to close it? Here is the code for the ASP file that is being run (Database connection info has been removed for security reasons):
Any help is appreciated. TIA!
Enkrypted
A+
Code:
<html>
<head>
<title>Intranet File Import</title>
<script>
window.opener = top;
var howLong = 5;
t = null;
function closeMe(){
t = setTimeout("self.close()",howLong);
}
</script>
</head>
<body onLoad="closeMe();self.focus()">
<%
Dim sqlCon
Set sqlCon = Server.CreateObject("ADODB.Connection")
sqlCon.ConnectionString =
sqlCon.Open
On error resume next
'folderstr = "W:\[URL unfurl="true"]www\intranet.sharperimpressionspainting.com\www.new\DocImport\"[/URL]
folderstr = "c:\intranetimport\"
'storestr = "W:\[URL unfurl="true"]www\intranet.sharperimpressionspainting.com\www.new\DocStore\"[/URL]
storestr = "c:\inetpub\sharp_intranet\docstore\"
Response.Write "<table width=""100%""><tr><td>Processing files.<br><!--<br>If you just uploaded a file manually from the intranet, do not be alarmed if you see more than just your file being processed. This page also serves to automatically collect files saved to the I drive<br><br><br>--></td></tr></table>"
'Display a list of files.
quotein = 0
conin = 0
cardin = 0
redcardin = 0
invin = 0
photoin = 0
checkin = 0
malcat = 0
malarr = 0
For i = 0 to 6
SELECT CASE i
CASE 0
procText = "QUOTES"
CASE 1
procText = "CONTRACTS"
CASE 2
procText = "GRADECARDS"
CASE 3
procText = "REDCARDS"
CASE 4
procText = "INVOICES"
CASE 5
procText = "PHOTOS"
CASE 6
procText = "CHECKS"
END SELECT
set fs = nothing
set folder = nothing
Response.Write "<li><b>PROCESSING " & procText & "</b></li>"
set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(folderstr & "\" & procText)
Response.Write(folder.Files.Count & " files, ")
' if folder.SubFolders.Count > 0 then
' Response.Write(folder.SubFolders.Count & " directories, ")
' end if
Response.Write(Round(folder.Size / 1024) & " KB total.")
' Response.Write("<ul>")
'Display a list of sub folders.
for each item in folder.SubFolders
'ListFolderContents(item.Path)
next
for each item in folder.Files
if instr(item.name, "-") = 0 then
fs.MoveFile folderstr & procText & "\" & item.name, folderstr & procText & "\" & ucase(procText) & "-" & item.name
'storestr & arr(1) &
'item.name = ucase(procText) & "-" & item.name
end if
Next
for each item in folder.Files
'response.write left(item.name, instr(item.name, "-") - 1)
arr=Split(item.name, "-")
if ubound(arr) = 1 then
extension = right(arr(1), 4)
arr(1) = left(arr(1), len(arr(1)) - 4)
SELECT CASE i
CASE 0
quotein = quotein + 1
CASE 1
conin = conin + 1
CASE 2
cardin = cardin + 1
CASE 3
redcardin = redcardin + 1
CASE 4
invin = invin + 1
CASE 5
photoin = photoin + 1
CASE 6
checkin = checkin + 1
END SELECT
If fs.FolderExists(storestr & arr(1)) = False Then fs.CreateFolder(storestr & arr(1))
If fs.FolderExists(storestr & arr(1) & "\" & procText) = False Then fs.CreateFolder(storestr & arr(1) & "\" & procText)
'Response.Write "<br>Move file, insert " & lcase(procText) & " path; record #" & arr(1) & "; file name: " & item.name
If fs.FileExists(storestr & arr(1) & "\" & procText & "\" & item.name) = True Then
renFile = 0
for h = 0 to 50
if fs.fileexists(storestr & arr(1) & "\" & procText & "\" & arr(0) & (h+1) & "-" & arr(1) & extension) = false AND renFile = 0 Then
arr(0) = arr(0) & (h+1)
'response.write "<br>S: " & folderstr & procText & "\" & item.name & "<br>"
'response.write "D: " & folderstr & procText & "\" & arr(0) & "-" & arr(1) & extension & "<br>"
fs.MoveFile folderstr & procText & "\" & item.name, folderstr & procText & "\" & arr(0) & "-" & arr(1) & extension
renFile = 1
End If
next
End If
'response.write "<br>S: " & folderstr & procText & "\" & arr(0) & "-" & arr(1) & extension & "<br>"
'response.write "D: " & storestr & arr(1) & "\" & arr(0) & "-" & arr(1) & extension & "<br>"
'response.write "INSERT INTO fileimports (QIID, FILENAME, FILETYPE, IMPORTDATE, OWNERREVIEW) VALUES (" & arr(1) & ",'" & arr(0) & "-" & arr(1) & extension & "', '" & procText & "','" & Now & "', 0)"
strSQL = "INSERT INTO fileimports (QIID, FILENAME, FILETYPE, IMPORTDATE, OWNERREVIEW) VALUES (" & arr(1) & ",'" & arr(0) & "-" & arr(1) & extension & "', '" & procText & "','" & Now & "', 0)"
'response.write strSQL
sqlCon.Execute strSQL
'response.write "<br>source: " & folderstr & procText & "\" & arr(0) & "-" & arr(1) & extension & "<br>"
'response.write "dest: " & storestr & arr(1) & "\" & procText & "\" & arr(0) & "-" & arr(1) & extension & "<br>"
fs.MoveFile folderstr & procText & "\" & arr(0) & "-" & arr(1) & extension , storestr & arr(1) & "\" & procText & "\" & arr(0) & "-" & arr(1) & extension
Else
malarr = malarr + 1
'Response.Write "<br>Malnamed file (improper array): " & item.name
End IF
'url = MapURL(item.path)
'Response.Write("<li><a href=""" & url & """>" & item.Name & "</a> - " & item.Size & " bytes, " & "last modified on " & item.DateLastModified & "." & "</li>" & vbCrLf)
next
Next
%>
<br>
<table>
<tr>
<td><div align="justify">Quotes:</div></td>
<td><%=quotein%></td>
<td><div align="justify">Bad Files:</div></td>
<td><%=malarr + malcat%></td>
</tr>
<tr>
<td><div align="justify">GCards: </div></td>
<td><%=cardin + redcardin%> / <%=redcardin%> flagged</td>
<td><div align="justify">Misnamed:</div></td>
<td><%=malarr%></td>
</tr>
<tr>
<td><div align="justify">Invoices</div></td>
<td><%=invin%></td>
<td width="113"><div align="justify">Invalid Category: </div></td>
<td width="241"><%=malcat%></td>
<td><a href="javascript:window.opener.document.location.reload( false );self.close();">Close</a></td>
</tr>
</table>
<%
function MapURL(path)
dim rootPath, url
'Convert a physical file path to a URL for hypertext links.
rootPath = Server.MapPath("/")
url = Right(path, Len(path) - Len(rootPath))
MapURL = Replace(url, "\", "/")
end function
On error GOTO 0
%>
</body>
</html>
Any help is appreciated. TIA!
Enkrypted
A+