
Using an ActiveX control within MSG.WSC
Hell is when you make something, other people break it, and then they ask you why it doesn't work... ;)
I found this interesting behavior using MSG.WSC; it *sort* of makes sense, but I'm not sure of the way out.
I have the "My Computer" zone set to allow everything before I run this. I embedded a reference to an ActiveX control in the HTML window for MSG.WSC. A VBS calling it runs fine. However, as soon as I add a sub that modifies the object, I get the classic message:
"An ActiveX control on this page is not safe.
Your current security settings prohibit running unsafe controls on this page.
As a result, this page may not display as intended."
MSG.WSC has been drastically modified, of course, but that's probably not the issue; I think that IE believes the WSC is being run from another zone.
Below are both the segment of my VBS which instantiates the WSC and the modified portion of the WSC embedded HTML. Is there a way around this being considered unsafe?
'===from VBScript
sFolder = Replace(WScript.ScriptFullName,wscript.scriptname,"")
set oCodeConsole = getobject("script:" & sFolder & "CodeConsole.wsc")
sFolder = empty
wscript.connectobject oCodeConsole,"oCodeConsole_"
oCodeConsole.show
' ====From header and body of the HTML resource within MSG.WSC
Sub window_onload
Setup_CodeWindow CSin
'Setup_CodeWindow CSout
End Sub
Sub Setup_CodeWindow(oWinID)
oWinID.GlobalProps = True
oWinID.SelBounds = True
oWinID.StealKeys = True
oWinID.LineNumbering = True
oWinID.LineNumberStart = 1
oWinID.AutoIndentMode = 2
oWinID.EnableDragDrop = True
oWinID.DisplayLeftMargin = True
oWinID.borderstyle = 10
oWinID.object.Language = "Basic"
oWinID.ColorSyntax = True
oWinID.HScrollVisible = False
End Sub
</script>
</head>
<body>
<div id=divHeader></div>
<div id=divInput><object
id=CSin
classid=clsid:A0F69707-2D87-4B20-9471-FBC003427134
width=800 height=240 ></object></div>