473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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.

Regards
[html]<HTML>
<BODY>
<Table>

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

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

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

<INPUT type="submit" value="Submit">
</FORM>
</TD>
</TR>

</Table>
</BODY>
</HTML>
[/html]
'------------- VBSCRIPT -------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <TITLE>List files and folders for users</TITLE>
  4. </HEAD>
  5.  
  6. <script language="VBScript" type="text/vbscript">
  7.  
  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
  11.  
  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
  15.  
  16. </script>
  17. </BODY>
  18. </HTML>
Oct 6 '07 #1
2 8491
jhardman
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")
  8.  
  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">
  6.  
  7. Dim wshell
  8. Dim Query
  9. Query = <%=Request.Form("Name")%>
  10.  
  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.

Jared
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

Regards
Oct 11 '07 #3

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

Similar topics

2
by: Graham Mattingley | last post by:
Hello I had this idea that I thought was going to be really simple, and I just cant get it to work.. I have use an affiliate link on my site, and I did not like it because it did not have my...
6
by: Pete Mahoney | last post by:
I am trying to 'POST' values from a form in a ASP file that has anonymous access permissions. I can retrieve the form values when I redirect to this page from another page which has also has...
4
by: Joey Martin | last post by:
I know how to use the LIKE command in a query but how do I do it in the results of a recordset? results="<b>Hello</b> World" I want to search the above result and if it has a <B> in it, I want...
13
by: David Morgan | last post by:
Hello I have a little function to highlight text if it exists. Function Highlight(vFind, vSearch) Dim RegEx Set RegEx = New RegExp RegEx.Pattern = vFind RegEx.IgnoreCase = True Highlight =...
1
by: Don Grover | last post by:
Please bear with me, I do not have a good understanding of HTTP POST and only a moderate understanding of XML. I maybe wrong in my explanation and interpritation so correct me if i am. I have to...
0
by: thomas | last post by:
Hi all, I was wandering is anyone can help. When I click on the 'view all' link on my homepage http://www.guitarmidi.co.uk I woild like to output the first 20 results on screen then have a...
0
by: tom | last post by:
Hi all, I'm having a bit of trouble getting my site to output a certain number of results per page. Any help on this would be greatly appriciated. Without this function my code outputs all...
2
by: gialby | last post by:
Ciao i have this problem.... i have a main asp page with this code PARENT PAGE <script language="vbScript"> function ricerca() ...
1
by: xernoth | last post by:
Hi there, Just a quick question. I'm more familiar with C# and ASP.NET but need to use ASP/VBScript for a quick project. I have a form that uploads content to a server not managed by us. When...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.