471,594 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Post ASP results to VBScript

Hi All,

Iím in a bit of pickle with ASP and VBscript variable and hope someone could get me some advice.

Thereís a FORMí Iíve created in ASP and its purpose is to capture the name(s) of users. The plan is then to pass the information from ASP to VBScript. My dilemma is how to extract the information in ASP and use it in VBScript. (Please see code below)

Iíve read in some forums that is simply canít be done. Unfortunately, I canít run what I need in any other form except in VBscript

There was one suggestion though to create a .vbs file and pass the ASP variable as an argument. But not having much experience with VBScript, Iím not 100% percent sure how that is done.

Thanks in advance for all the help.


<TR height="20" style="height: 15.0pt">
<TD colspan="8" align=Left>
<img border="0" src="R:\Pic.bmp" width="150" height="150">

<FORM method="POST" action="ActionRequest1.asp">

Customer :
<select multiple name="Name" Size="3">
<option value =" John " selected> John </option>
<option value =" Jane "> Jane </option>
<option value =" Cory "> Cory </option>

<INPUT type="submit" value="Submit">

'------------- VBSCRIPT -------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>List files and folders for users</TITLE>
  4. </HEAD>
  6. <script language="VBScript" type="text/vbscript">
  8. Dim wshell
  9. Dim Query
  10. Query = Request.Form("Name")Ď <----- Need the variable from ASP which is where Iím stuck at the moment
  12. Set wshell = CreateObject("WScript.shell")
  13. wshell.run "%comspec% /C R: & CD \" & Query & " & Dir /S /T:W /O:D *.txt > c:\Results.txt", 0, True
  14. set wshell = nothing
  16. </script>
  17. </BODY>
  18. </HTML>
Oct 6 '07 #1
2 8335
3,406 Expert 2GB
I'm not sure I understand you, I tend to use the terms "ASP" and "VBScript" interchangeably. ASP is usually written with a scripting language such as VBScript, most people don't use VBScript for anything else. Are you trying to use VBScript on the client-side (a script that runs on the user's browser) or on the server-side (a script that the server reads and executes before it is sent to the final web page)? If the former is the case (the way most people use VBScript), then I would write it like this:
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>List files and folders for users</TITLE>
  4. </HEAD>
  5. <%Dim wshell
  6. Dim Query
  7. Query = Request.Form("Name")
  9. Set wshell = CreateObject("WScript.shell")
  10. wshell.run "%comspec% /C R: & CD \" & Query & " & Dir /S /T:W /O:D *.txt > c:\Results.txt", 0, True
  11. set wshell = nothing %>
  12. </BODY>
  13. </HTML>
Otherwise I might warn you that only the internet explorer browser (which is no longer the most-used browser) ever supported client-side VBScript. But if you did want it to look like that, try this:
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>List files and folders for users</TITLE>
  4. </HEAD>
  5. <script language="VBScript" type="text/vbscript">
  7. Dim wshell
  8. Dim Query
  9. Query = <%=Request.Form("Name")%>
  11. Set wshell = CreateObject("WScript.shell")
  12. wshell.run "%comspec% /C R: & CD \" & Query & " & Dir /S /T:W /O:D *.txt > c:\Results.txt", 0, True
  13. set wshell = nothing 
  14. </script>
  15. </BODY>
  16. </HTML>
This will still need to be saved as .ASP for the server to insert the text in the appropriate place. I do not know whether there is a way to access posted data through purely client-side scripts. Perhaps if the data is sent through the querystring... but I'm not an expert on client-side anything. Let me know if this helps.

Oct 8 '07 #2
Thanks Jared. I will give it a try. The other option I was considering was to store the results into a Database before running SQL query for the Shell script.

Thanks once again for your help

Oct 11 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Graham Mattingley | last post: by
4 posts views Thread by Joey Martin | last post: by
13 posts views Thread by David Morgan | last post: by
1 post views Thread by Don Grover | last post: by
reply views Thread by thomas | last post: by
reply views Thread by tom | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.