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!

VBscript code to let me point to a executable on my server

Status
Not open for further replies.

vemate

Programmer
Aug 23, 2002
61
US
<! This script executes Forest Products Accounting from the Intranet WEB>
<Input language="VBScript" type="Button" value="Click FPA System" 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:\TZO\FPAWEB.TZO.COM\OLM_DOWNLOAD\simple.hta")
End Sub
<!--------------------------------------------------------------->
This shell code calls a hta file from my web site but the path is lost and I cannot execute the program. I am no expert with vbscript. I need a way to make sure my path is pointing to my F: drive which is the drive my Web site runs the executables from. I am using hta which is a html program that allows execution with html. I would appreciate code to show me how to set my data path correctly.

Thank you very much.
 
So, in the HTA, what does the line of code that calls aas2.exe look like?
 
<html>
<head>
<title> FPA Demo System
</title>
</head>
<p align=center><font size=4 color=navy>
Forest Products Accounting
<p>
<body bgcolor=lightyellow>
<br>
<div align=center>
<button onclick="self.close()">[ STOP ]

</button>
<form method="post" action="f:\tzo\fpaweb.tzo.com\fpa\aas2.exe") onSubmit=""></a>

<input type="submit" value="FPA [ DEMO ]"></a><br><br>


</body>
</html>
 
This isn't really written as an HTA. Try rewriting it so that you have a window_onload sub. In that sub, create a shell object and exec the aas2.exe file. Also, according to what you told me above, the path should be:
f:\tzo\fpa\aas2.exe
Not:
f:\tzo\fpaweb.tzo.com\fpa\aas2.exe
 
You lost me. I am struggling to get the vbshell to work.

I do not know what you mean window_onload sub. Is this VBscript? This is the right path F:\tzo\fpa\aas2.exe
I was going by what Microsoft said that all you have to do to htm is change the extention to hta that is what I did. But apparently that is incorrect.
 
I need to go home now. I will try to post more over the weekend, but I may not be able to until Monday. (having wisdom teeth pulled tomorrow)
 
I really appreciate all your help. Sorry about the teeth.
Hope you do not have much pain.

You have been so helpful
Thanks again
 
Hi friend I hope you are feeling well today.
Here is my code to exexute my program what do you think.
How do I execute it?? Do I need a submitt somewhere.

<html>
<HEAD>
<body bgcolor=lightyellow>
<p align=center>
<font size=4 color=navy>

Forest Products Accounting
<SCRIPT LANGUAGE="VBSCRIPT">

On Error Resume Next
Set obj = CreateObject("f:\tzo\fpa\aas2.exe")
If Err.Number >0 Then MsgBox _ Err.Description

<!%@ Language=VBScript %>

<%
Set objShell = Server.CreateObject("WScript.Shell")
objShell.Run("f:\tzo\fpa\aas2.exe")
Set objShell = Nothing
%>

</SCRIPT>
</HEAD>

<html>
 
I don't think you need this part at all:

On Error Resume Next
Set obj = CreateObject("f:\tzo\fpa\aas2.exe")
If Err.Number >0 Then MsgBox _ Err.Descriptio

Tell me again what is or is not happening.
 
I sumbitt this code with another HTM program and nothing happens I get a blank screen.

<html>
<HEAD>
<body bgcolor=lightyellow>
<p align=center>
<font size=4 color=navy>

<Script language="VBScript">

Set objShell = Server.CreateObject("WScript.Shell")
objShell.Run("F:\tzo\FPA\AAS2.EXE")
Set objShell = Nothing

</SCRIPT>
</HEAD>
<html>
 
I changed the extention to .hta and changed this line to
Set objShell = CreateObject("WScript.Shell")
and it ran but.

I need a path statement because I am looking for the winnt folder I am being sent to the desktop for some reason and I cannot find my aas2.ini file which is located in the winnt folder this is my data path.

Do you know how to put a path statement to stop me from going to the desktop to run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top