Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML that uses WScript that calls HTA without prompt

Status
Not open for further replies.

Phalanx1

Programmer
Jul 21, 2003
128
US
<code>
<html>
<head>
<title>Learn something new</title>
</head>
<body>
<Input language=&quot;VBScript&quot; type=&quot;Button&quot; value=&quot;Click me&quot; onclick=&quot;ExecHTA()&quot;>
<Script language=&quot;VBScript&quot;>
' Public Object so i dont have to keep making them
'and they are separated by subs or functions
Public w
Set w = CreateObject(&quot;WScript.Shell&quot;)

Sub ExecHTA()
w.Exec(&quot;mshta C:\TheEx.hta&quot;)
End Sub

</Script>
</body>
</html>
</Code>
 
This is the other file
Remove the code tags to make it work
<code>
<html>
<head>
<title>Wsh example in hta</title>
<HTA:APPLICATION
applicationName=&quot;HTAExamp&quot;
border=&quot;thin&quot;
borderStyle=&quot;normal&quot;
caption=&quot;yes&quot;
maximizeButton=&quot;yes&quot;
minimizeButton=&quot;yes&quot;
showInTaskbar=&quot;no&quot;
windowState=&quot;normal&quot;
innerBorder=&quot;yes&quot;
navigable=&quot;yes&quot;
scroll=&quot;auto&quot;
scrollFlat=&quot;no&quot;
singleInstance=&quot;yes&quot;
sysMenu=&quot;no&quot;
contextMenu=&quot;no&quot;
selection=&quot;yes&quot;
version=&quot;1.0&quot; />
</head>
<BODY>

<Object id=Web classid=clsid:8856F961-340A-11D0-A96B-00C04FD705A2>
<PARAM NAME=&quot;ExtentX&quot; VALUE=&quot;7011&quot;>
<PARAM NAME=&quot;ExtentY&quot; VALUE=&quot;5001&quot;>
<PARAM NAME=&quot;ViewMode&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Offline&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Silent&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;RegisterAsBrowser&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;RegisterAsDropTarget&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;AutoArrange&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;NoClientEdge&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;AlignLeft&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;NoWebView&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;HideFileNames&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;SingleClick&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;SingleSelection&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;NoFolders&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;Transparent&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;ViewID&quot; VALUE=&quot;{0057D0E0-3573-11CF-AE69-08002B2E1262}&quot;>
<PARAM NAME=&quot;Location&quot; VALUE=&quot;res://C:\WINDOWS\System32\shdoclc.dll/dnserror.htm# </OBJECT>
<input type=&quot;button&quot; value=&quot;Click me&quot; language=&quot;VBS&quot; onmousemove=&quot;CrtVBS()&quot; onclick=&quot;ExecFile()&quot;>
<input type=&quot;Button&quot; value=&quot;Delete VBS&quot; onclick=&quot;DelVBS()&quot;>
<script language=&quot;vbscript&quot;>

Web.Navigate &quot; 2 ' I like google
Dim fso
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Sub CrtVBS()
Dim vbs
Set vbs = fso_OpenTextFile(&quot;C:\vbsinc.vbs&quot;, 2, true)
vbs.WriteLine(&quot;WScript.Echo &quot;&quot;Hey it worked&quot;&quot;&quot;)

End Sub
document.writeln &quot;this is an example of creating a vbs file for a web application so that it can use WScript&quot; & &quot;<br>&quot;

Sub ExecFile()
Dim w
Set w = CreateObject(&quot;WScript.Shell&quot;)
w.Run &quot;WScript c:\vbsinc.vbs&quot;,2
End Sub
Sub DelVBS()
Dim pth
pth = (&quot;C:\vbsinc.vbs&quot;)
If fso.FileExists(pth) Then
fso.DeleteFile(&quot;C:\vbsinc.vbs&quot;)
End If
End Sub
</script>
</BODY>
</html>
</code>
 
This contains my code. The programs only returns a blank screen. Do you see any thing I am doing wrong....

My main Program.............
<html>
<body bgcolor=lightyellow>
<font size=5 color=navy>
<div align=center><b>
Automated Accounting Systems</b>
<p>
<div align=left>
<IMG src="images/logo.jpg" border="4" width="270" height="350" align=left>
<font size=2 color=green></div>
<hr size="20"></hr>
<!------------------------------------------------------------------------------------------------------------------------->
<div align=left>
<IMG src="images/flag.jpg" border="1" width="20" height="20"> &nbsp &nbsp
Forest Products Accounting <font color=blue>Demo</font> system.
<br>Please <b>CLICK FPA DEMO</b> and <b>OPEN</b> to start using our system.
<p align=center>
<form method="get" action="call_vbscript.htm">
<input type="submit" value="FPA DEMO">
<!----------------------------------------------------------------------------------------------------------------------->
<p><hr size="20"></hr>
<p></div>
<div align=center>
<a href="index.htm"><font color=blue><b>Back to Top of Page</b></font>
<font color=red size=4>
<div align=center>
<p>
Innovative Software Solutions for the Forest Products Industry
</div>
</body>
</font>
</html>

The script calling program......
<html>
<head>
<title>FPA WEB DEMO</title>
</head>
<body>
<div align=center>
<font size=4 color=navy>
Forest Products Accounting
<p><font color=green>
Active [DEMO]
<p>
<! This script executes Forest Products Accounting from the Intranet WEB>
<Input language="VBScript" type="Button" value="Click FPA" onclick="ExecHTA()">
<Script language="VBScript">
' Public Object so i dont have to keep making them
'and they are separated by subs or functions
<!--------------------------------------------------------------->
Public w
Set w = CreateObject("WScript.Shell")
Sub ExecHTA()
w.Exec("mshta F:\vbscript.HTA")
End Sub
<!--------------------------------------------------------------->
</Script>
</body>
</html>


The actual (HTA) that is suppose to execute my program
............
<html>
<head>
<title>Execute FPA from the WEB</title>

<HTA:APPLICATION
applicationName="F:\FPA\AAS2.EXE"
border="thin"
borderStyle="normal"
caption="yes"
maximizeButton="yes"
minimizeButton="yes"
showInTaskbar="no"
windowState="normal"
innerBorder="yes"
navigable="yes"
scroll="auto"
scrollFlat="no"
singleInstance="yes"
sysMenu="no"
contextMenu="no"
selection="yes"
version="1.0" />
</head>
<BODY>

 
Your hta have no body, so nothing to do but display a blank screen.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
PHV is right in his regard but I get the inclination that you think applicationName is the actual path to the executable to be called and displayed, in the hta. This is not so my friend you have to call an exe some other way. like the registry, then you have to setup bindings in the hta, and binders in the executable, so far i have yet to accomplish this... but what you can do is create a bat file that writes the output of the exe to a text file, read that text file and dispay it in the hta.

cheers, Phalanx1

p.s. it's been some time since I have seen this thread, i thought it was to be forgotten. [tongue]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top