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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to start a vbscript from web page

Status
Not open for further replies.

Niavlys

IS-IT--Management
Jun 3, 2002
197
CA
Hi, I need to start a script from a web page. I need a solution in asp or html. I tried with wsh.run("script.vbs") but it seems to start only exe applications. I tried writing my vbs in a batch file without good results. It should be simple, when I click submit, start the script.

It looks easy but I can't figure out how to make it work.

Any help appreciated!
Thanks!
 
Is this a client-side script? I don't know about vbscript, but with javascript you would use:

<form action=&quot;whatever&quot; onSubmit=&quot;functionName()&quot;>

or I guess if it's server-side, you could place the script in an .asp page and call the .asp page with:

<form action=&quot;processing_page.asp&quot;>

Does that help?

 
it is a client-side script, I want to run the script (.vbs)when I click the submit button. I have something like that:
Code:
<%@ Language=VBScript %>
<html>

<head>
<%
  Fname = request.querystring(&quot;Fname&quot;) 
   
  dim wsh, return
 
  if Fname <> &quot;&quot; Then
	set wsh = Server.CreateObject(&quot;WScript.Shell&quot;)
    	return = wsh.run(&quot;CreateUser.vbs&quot; & &quot; &quot; & Fname,3,TRUE)
	Response.Write &quot;In IF   &quot; & Fname & &quot;return =   &quot; & return 
  End if 
  
 
%>
</head>
<body>
<form name=form1 method=&quot;get&quot;>
  	<h3>Enter user informations</h3>
	First Name :
	<input type=&quot;text&quot; name=&quot;Fname&quot;>
	Password :
	<input type=&quot;password&quot; name=&quot;Password&quot;>
	<br>
	
	<input type=&quot;submit&quot; value=&quot;Create User&quot;>
</form>
</body>
</html>
[\code]

I don't know what I'm doing wrong but the script doesn't start.
 
This looks like server-side to me &quot;Server.CreateObject(WScript.Shell)&quot;, and so it will need to be an .asp page.

I've done very little with ASP, but I would think that if you're trying to do it all within one page, you'll need to use a flag to see if they've already submitted or if they're just coming to the page. Then you'll need to call a subroutine or function to run the code up above when they submit.

... but I'm definitely not the one to ask so I suggest you post in the .asp forum (I think there's one here isn't there?) ;-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top