hta

Access VBScript variable within Javascript inside of an HTA

二次信任 提交于 2019-12-11 02:59:39
问题 I'm trying to access a variable in javascript that i set in vbscript all within one hta file: <script type="vbscript"> var globalVariable = test123 </script> <script type="text/javascript"> var globalVariable = <%= globalVariable %>; </script> This doesn't populate the variable globalVariable with anything. I've also tried var globalVariable = "<%= globalVariable %>"; This just populates the string within the quotes into the variable globalVariable. I can't get the value ' test123 ' set in

Unterminated string constant-mshta:javascript

ⅰ亾dé卋堺 提交于 2019-12-11 02:58:39
问题 Recently I was trying to get a quick alert box from javascript using mshta but I noticed something strange and I have no ideea what the problem is. This is,in a way,what I was trying to achieve: mshta javascript:alert("The file was stored here:\"C:\\folder_with_space_ _.txt"); The error it gives is the one in the title of this post(char 57).I tried a combination of things and: //code that works: mshta javascript:alert("The file was stored here:\"sdadasd"); mshta javascript:alert("The file was

Using HTA in vbscript

拟墨画扇 提交于 2019-12-11 01:24:29
问题 While using HTA userform for VBscript, I found that HTA doesn't support WScript and its objects/methods. Is there any alternate way of creating userform or is thery any way to make HTA support WScript? 回答1: An alternative to WScript.Echo would be to simply add content to the DOM: <script language="vbscript"> dim div: set div = document.getElementById("output") div.innerText = "output" </script> <div id="output"/> or if you want a dialogbox instead, you can use MsgBox() <script language=

HTA : “Safety Settings on this computer prohibit accessing a data source on another domain”

♀尐吖头ヾ 提交于 2019-12-10 19:08:15
问题 I am dealing with the same error message (as the subject) like two other threads: Suppress ADO Security Warning in JavaScript/HTM Page and How to create intranet website accessing database dynamically without server or server side scripts? but my application runs on the local computer only, it has nothing to do with any network or remote database. The problem happens on some of my users' computer only. I have simplified the program to 1.js and 1.hta as listed below. Run 1.js through command

Make an HTA file run as admin (elevated)

大兔子大兔子 提交于 2019-12-10 17:32:23
问题 In wsf, vbs and js files you can easily find out if they run elevated and if not you can easily make them. The code I've written for that is this: EnsureElevatedPrivileges(); WScript.Echo("Running elevated now!"); function EnsureElevatedPrivileges() { if (!WScript.Arguments.Named.Exists("elevate")) { new ActiveXObject("Shell.Application").ShellExecute(WScript.FullName, "\"" + WScript.ScriptFullName + "\" /elevate", "", "runas", 1); WScript.Quit(); } } But this doesn't work in HTA files

Live updates of the Mouse Position in HTML/HTA Document

大城市里の小女人 提交于 2019-12-10 11:46:08
问题 I would like to be able to constantly LIVE update the mouse position in a HTA window. I know that Window.Event is only available when a DOM event is being called. so having a function that does this VBScript: Function vbsUpdateMousePos() Dim X,Y, MouseX, MouseY Set MouseX=document.getElementById ("MouseX") Set MouseY=document.getElementById ("MouseY") X=Window.Event.ClientX Y=Window.Event.ClientY MouseX.value=X MouseY.value=y End Function JScript: function jsUpdateMousePos () { var MouseX

How to play a sound on an HTA file

眉间皱痕 提交于 2019-12-10 10:49:10
问题 Ive been searching the internet for a while now and no tutorial has explained how to play sound <Audio autoplay> <source src="sound.mp3" type="audio/mp3"> </Audio> No errors are displayed but no sound plays either, all help is appreciated 回答1: Just simply use bgsound element to play an audio file: <bgsound src="audio.mp3"> You can also specify a number for loop attribute which indicates how many times the audio file is to be played. If you want to play your sound whenever a particular event

Executing 32bit and 64bit mshta.exe (bypass default handler)

隐身守侯 提交于 2019-12-10 10:04:49
问题 I'd like to be able to launch a page.hta in 32bit and 64bit versions of the mshta.exe. Create the file c:\page.hta <body onclick="if(confirm('Close? (onclick)')){self.close();}"> <h1>Test Page</h1> <script type="text/javascript"> var elem = [ "UserAgent="+window.navigator.userAgent, "Platform="+window.navigator.platform ]; var taBegin = "<textarea style='width:100%' rows='"+((elem.length+1)*1.5)+"'>"; var taEnd = "</textarea>"; document.write(taBegin+elem.join("\n")+taEnd); </script> </body>

HTA opens internet explorer on enterbutton

偶尔善良 提交于 2019-12-08 09:09:23
问题 I am trying to learn the basics of HTA but I am running into a problem. I want a HTA GUI with a text box that I can add my own VBScript to. When I press enter in the text box internet explorer opens and prompts me to open/save the HTA file. What is causing this to happen and how can I stop it? I am using Windows 8 and have IE10. <html> <head> <HTA:APPLICATION APPLICATIONNAME="Simple HTA" SINGLEINSTANCE = "Yes" SYSMENU="yes"> <title>Simple HTA</title> <style type="text/css"> body {background

HTA file save dialog instead of open dialog

谁都会走 提交于 2019-12-08 06:01:48
问题 I want to use a file input to open a save dialog instead of a open dialog. This will allow the user to give output locations. in my application. My HTA code is <html> <head> <title>HTA Test</title> <HTA:APPLICATION ID="objTest" APPLICATIONNAME="HTATest" SCROLL="yes" SINGLEINSTANCE="yes" > <script> function sync() { var InputTextbox = document.getElementById('InputTextbox'); var OutputTextbox = document.getElementById('OutputTextbox'); OutputTextbox.value = InputTextbox.value; } </script> <