INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...Congratulations on a brilliant idea and a great site..."

Geography

Where in the world do Tek-Tips members come from?

 HTML that uses WScript that calls HTA without prompt

Phalanx1 (Programmer)
10 Oct 03 22:04
<code>
<html>
<head>
<title>Learn something new</title>
</head>
<body>
<Input language="VBScript" type="Button" value="Click me" 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 C:\TheEx.hta")
End Sub

</Script>
</body>
</html>
</Code>
Tek-Tips Forums is Member Supported. Click Here to donate.
Phalanx1 (Programmer)
10 Oct 03 22:07
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="HTAExamp"
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>

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

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

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

Sub ExecFile()
    Dim w
    Set w = CreateObject("WScript.Shell")
    w.Run "WScript c:\vbsinc.vbs",2
End Sub
Sub DelVBS()
Dim pth
pth = ("C:\vbsinc.vbs")
If fso.FileExists(pth) Then
fso.DeleteFile("C:\vbsinc.vbs")
End If
End Sub
</script>
</BODY>
</html>
</code>
vemate (Programmer)
29 Mar 04 16:39
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>

PHV (MIS)
29 Mar 04 16:43
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

Phalanx1 (Programmer)
30 Mar 04 16:44
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.

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: VBScript Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=329
DESCRIPTION: VBScript technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.

 

Back To Forum