hta

How can I open a link in the default web browser from an HTA?

房东的猫 提交于 2019-11-27 14:29:10
I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <a href="url" target="_blank"> opens the link in IE regardless of the default browser. Is there a way to use the default browser? Using JavaScript is an option. Create a shell and attempt to run a URL. This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head>

How to get IE9 standards support for dialogs opened by HTA?

ⅰ亾dé卋堺 提交于 2019-11-27 09:48:00
I'm translating some of my old HTAs from Quirks to IE9 standards. However, it seems that modal and modeless dialogs opened by HTA don't support IE9 standards mode. Test dialog: <!DOCTYPE html> <html> <head> <title>TestDialog</title> <meta http-equiv="x-ua-compatible" content="ie=9" /> </head> <body> <svg> <circle cx="100" cy="100" r="50" fill="#0f0" /> </svg> </body> </html> In the HTA main page: <button onclick="showModalDialog(...)">Modal</button> <button onclick="showModelessDialog(...)">Modeless</button> When opening TestDialog from HTA, it's empty. If the main page is a regular html

Writing data to a local text file with javascript

五迷三道 提交于 2019-11-27 07:43:20
I have created a procedure to write content to a text file in my local machine. <form id="addnew"> <input type="text" class="id"> <input type="text" class="content"> <input type="submit" value="Add"> </form> <script> jQuery(function($) { $('#form_addjts').submit(function(){ writeToFile({ id: $(this).find('.id').val(), content: $(this).find('.content').val() }); return false; }); function writeToFile(data){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var fh = fso.OpenTextFile("D:\\data.txt", 8); fh.WriteLine(data.id + ',' + data.content); fh.Close(); } }); </script> This is

ActiveX event handlers in an HTA using Javascript

大兔子大兔子 提交于 2019-11-27 06:38:39
问题 In C# I can write event handlers as follows: var wdApp = new Microsoft.Office.Interop.Word.Application(); wdApp.DocumentBeforeSave += (Document doc, ref bool saveAsUI, ref bool cancel) => { //do stuff here }; In VBA/VB6, I can use static event handling: Dim WithEvents wdApp As Word.Application Private Sub wdApp_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean) 'do stuff here End Sub I would prefer to use dynamic event handling. However, in Javascript, even when

localStorage like storage alternatives for HTA

萝らか妹 提交于 2019-11-27 06:21:01
问题 I am developing a HTA application, for that I need to store some data at client side using JavaScript. Like localStorage in HTML5, I am just looking for same functionality if possible. Please let me know if I can found any. 回答1: In HTA you are free to use any ActiveX you want. FileSystemObject is the best solution for simple folder and file actions, though it can read and write text files only. With this ActiveX Control you can also create and delete folders and files, retrieve their

VBScript file or folder selection

雨燕双飞 提交于 2019-11-27 03:41:37
问题 I have a small hta file with few vbs codes. It selects folder or file then make a copy to a fixed location. <html> <head> <Title>File Copy </Title> <style> img.exco { position:absolute; bottom:10px; right:10px } </style> <!--Put this sub here to avoid resize flickering.--> <script language = "VBScript"> sub DoResize 'resize window.resizeTo 690,350 screenWidth = Document.ParentWindow.Screen.AvailWidth screenHeight = Document.ParentWindow.Screen.AvailHeight posLeft = (screenWidth - 700) / 2

HTA and 'x-ua-compatible' meta tag

故事扮演 提交于 2019-11-26 23:17:51
问题 Added to post Jun-19-2014 Thanks Bond. Since you had IE9, I appreciate your test. Hopefully if somebody out there has IE 10 they will test it, too. It does not make any sense why under the IE 11 engine you can only run compatibility up to ie8. I created this tiny, itty-bitty HTA in order to post it so hopefully I can find out what I am missing. My system is a Win7 Pro 64bit with IE 11. When I set the meta tag as: <meta http-equiv="x-ua-compatible" content="ie=8"> the HTA runs peachy-keen. No

How to close a HTA window from another HTA?

不问归期 提交于 2019-11-26 18:38:21
问题 I've tried to implement my own modal dialogs (Why?). I open a new window using WScript.Shell : dlg = shell.Run(dlgPath, 1, true); The line above creates a "semi-modal" HTA window. The script execution is stopped at this line, but the main window is still responsive. This issue is tackled within onfocusin eventhandler, which returns focus back to the new HTA window using shell.AppActivate() . This prevents even "Close Window" button to close the main window. However, in Windows7 there's a back

How can I open a link in the default web browser from an HTA?

ⅰ亾dé卋堺 提交于 2019-11-26 18:24:34
问题 I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <a href="url" target="_blank"> opens the link in IE regardless of the default browser. Is there a way to use the default browser? Using JavaScript is an option. 回答1: Create a shell and attempt to run a URL. This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox: <!DOCTYPE

JavaScript version in HTA

主宰稳场 提交于 2019-11-26 00:55:53
问题 Does anyone know what version of JavaScript is used by HTA files. Currently creating some script files - and trying to make use of Object.defineProperty When running as an HTA - it errors stating that Object doesn\'t support this property or method. I\'ve run it as an HTM file just to check - and there is no problem at all. So I can only assume that mshta.exe is using an older JavaScript engine. Can any one confirm this? 回答1: The used JavaScript (or JScript) version depends on three things: