This will create the file and open it. having trouble with it prompting to save or open the file. PHV, can you suggest a change to overcome this?
'==========================================================================
'
' NAME: <filename>
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL:
' DATE : 3/18/2004
'
' COMMENT: <comment>
'
'==========================================================================
Set fso = CreateObject("Scripting.FileSystemObject")
set WshShell = CreateObject("WScript.Shell")
htaStartText = "<html><title>Important Message</title><body " & Chr(34) & "width=500, height=400, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes" & Chr(34)&"><hr><br>" & vbCrLf
msgText = "<h1>Warning</h1>You are attempting to access a company PC. Please stand by while storm troopers are dispatched to beat the stuffing out of you!" & vbCrLf
htaEndTxt = "<hr></body></html>"
If fso.FileExists("c:\notice.hta") Then
fso.DeleteFile("c:\notice.hta")
End If
Set ts = fso.CreateTextFile ("c:\notice.hta", ForWriting)
ts.write htaStartText & msgText & htaEndText
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate2 "c:\notice.hta"
'tried this to get prompt to save or open to go away
'WshShell.AppActivate "iexplore"
'WScript.Sleep 200
'WshShell.SendKeys "+{Tab}"
'WshShell.SendKeys "{Enter}"
While IE.busy
wscript.sleep 10
Wend
IE.Visible=True
I hope you find this post helpful. Please let me know if it was.
Regards,
Mark