Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Really Simple VBScript problem (Embarassingly Simple)


Really Simple VBScript problem (Embarassingly Simple)

Author
Message
Mobius
Mobius
Forum God
Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)

Group: Forum Members
Posts: 632, Visits: 1K
So, I have a need to write a small script in the form of a web page so that we can poll it from an IVR system that will go out to a database, find a value based on an argument passed to the web page script, and return an XML response. However, I don't quite know how to pass arguments to a web page that's running a vbscript in the first place. It would be similar to this:

html
body
script type="text/vbscript"
If WScript.arguments(0) <> "" Then
arg1 = "WScript.arguments(0)"
End If
document.write(arg1)
document.write("Hello.......")
/script
/body
/html

In this though, I used code that I know works for passing parameters to a locally run VBScript. Is it done the same way?

I just want to be able to do something like this:

http://site/?SOME_PARAMETER

....and the script would pick up the value of "SOME_PARAMETER".

I know, simple, right? I'm not really a developer anymore so I'm kind of rusty. Any ideas?





-Mobius

dilettante
dilettante
Forum God
Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)Forum God (3.6K reputation)

Group: Forum Members
Posts: 9, Visits: 54
Your "web page" can't be static, it must live in some sort of Web server.  Then you'd construct the page using CGI, ASP, etc. techniques.

Your code above is not using "regular VBScript" but instead VBScript in the context of the WSH script engine.  To do what you want means something like ASP, where IIS and its ASP subsystem are the script host for VBScript, with different rules.

The server gets the request from the client, wraps up the request info one way or another (depending on the dynamic Web technology and API you are using) and passes it to the "page" which contains script that runs.  This "page" actually emits an HTML response back through the Web server for delivery back to the client.

Things like ASP pages sort of look like HTML with script embedded, but the parts that appear to be HTML are actually parsed and wrapped up as Response.Write calls behind your back, and executed inline with the explicit script of the page.

Example:

<html>
<body>
<%
Response.Write("Hello World!")
%>

</body>
</html>

The <% %> markers surround script to be executed.  Anything outside those markers is considered literal text to be written out.

In ASP you have a Request object passed to your script.  This has properties for things like the QueryString.  Request.QueryString is a collection, built from an expected string syntax of name=value pairs like:

http://site/something.asp?name=John&age=30

This gives your ASP page a Request.QueryString collection with two items: name and age with values John and 30.

If you break the rules and want to just grab the unparsed query string you could use Request.ServerVariables("QUERY_STRING") which would return the string value "name=John&age=30" instead.

Edited
7/5/2009 by dilettante
Mobius
Mobius
Forum God
Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)

Group: Forum Members
Posts: 632, Visits: 1K
I appreciate the novel, but I was looking for something like what you were getting at in the last paragraphs, not a tutorial on how web pages work. Been doing this for a while. Wink

I'm trying to get a basic script working that will return certain values based on input when gone through a database query to return an XML reponse for our IVR system. The idea is to send info to the script, such as location ID, and the database will contain information about the facility's hours of operation. The XML response will contain this information, and the IVR will speak to the caller via different menus, depending on the open/closed status of the facility.

This is just a test system, I'm a telephony architect, and the real thing would be constructed by our web team. I just want to see if I can get it working.





-Mobius

Mark
Mark
Forum God
Forum God (141K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
OK, if you navigate to http://site/something.asp?name=John&age=30 are you able to pull the name and age values?

What exactly do you need next?

Mobius
Mobius
Forum God
Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)

Group: Forum Members
Posts: 632, Visits: 1K
Yeah - it works now. That whole post could have been reduced to the last paragraph, that's all I needed. Sorry that he wore his keyboard down.



That's it...I just needed the syntax for it. I'll just grab the whole string since there's only going to be one value passed to this script. Only thing left is to do a database dip.





-Mobius

arjonsk
arjonsk
Forum God
Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)Forum God (405 reputation)

Group: Forum Members
Posts: 1, Visits: 1
how do we make asp check the case of the strings entered.i currently have a running db login... the thing is that i cant make asp check the case of the passwords entered..... and my search pages cant distinguish between "product" and "product" in a search page.







online bingo






GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search