Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: open
As a basic example, from an HTA, using window.open, you can open an instance of IE full screen in "kiosk" mode whereas from another IE window, for security purposes, you no longer can.
If you check the MS DHTML docs for window.open, it mentions this.
Any way to fix this?
var ie = new ActiveXObject("InternetExplorer.application");
You can swap references with the window, and get it to pass back any actions that require priveleges.
Here's a simple example of launching IE. It's done within WSH, so they have the extra ability to add an event handler to the application itself, which you can't do using the ActiveXObject constructor - but you can work around this.
Here's the documentation for the API:
First off, the link you gave me, Bernard, was to a VBScript documentation.
Secondly, I need the instance to be its own application. It can't be suseptible to IE actions, like F1, and CTRL+D. The runApp() code works all except that it cannot communicate with the opener HTA window. Does anybody have a solution?
That shouldn't matter too much, adni, sir. Whether we use VB- or JScript for the scripting, the API for the relevant objects, and methodology itself, remain the same. When I first looked at those documents I had only the flimsiest grip on VBScript - and things haven't improved much since then (I largely keep away from it).
You could get round the bookmarking issue by, instead of navigating the new window, innerHTML'ing its content from code stored in a text file or hidden inside a comment in the HTA. Hmm.
It would be nice if HTAs could reference each other by ID or APPLICATIONNAME, but it doesn't seem so.
You might find the answer in showModal/ModelessDialog(). It turns out that windows launched thusly by an HTA are also trusted.
Good point Bernard. You have more control over those when launched from an hta. The only minor problem is if you keep the window chrome you get the IE logo in the title bar. If that works for adni it should solve the problem.
adni, most, I'd guess around 80%, of MS scripting examples are written in vbs. It's something you'll need to learn a bit about so you can write htas with js.
Once you learn the language a little you'll be able to use vbs and js together. Taking the bests of both languages, which for me means mostly js :)
Here is an example hta that uses js to call some useful/convenient vbs functions. MsgBox in particular is a must have for htas. The functions are simple enough (like my vbs knowledge) to learn the basic language structure.
<title>JS & VBS</title>
<script type="text/jscript" language="jscript">
return vb_month(this.getMonth()+1,0)+' '+this.getDate()+','+this.getFullYear()
'Are you sure you want to take this action?','custom title'
'vb_confirmWarning() = '+chk+
'\n\n vb_toCurrency(1000.333) = '+vb_toCurrency(1000.333)+
'\n\nday of year = '+vb_dayOfYear(new Date().vbDate()));
<script type="text/vbs" language="vbscript">
MsgBox str,vbOKOnly + vbInformation + vbApplicationModal,vb_dialogueTitle(title)
vb_confirmWarning = MsgBox(str,vbYesNo + vbCritical + vbDefaultButton2 + vbApplicationModal,vb_dialogueTitle(title)) = vbYes
If title = Empty Then
vb_dialogueTitle = document.title
vb_dialogueTitle = title
vb_toCurrency = FormatCurrency(num)
vb_month = MonthName(num,abbrev)
vb_dayOfYear = DatePart("y",DateValue(date_str))