Click to See Complete Forum and Search --> : Newbie Alert: Calling a Parameterised vbscript from an HTML page - can it be done?


Kinch
03-15-2005, 10:31 AM
Hi All
I'm a SQL developer but have been asked to put together a page for our intranet to allow people to connect to a given printer. At ths point i need a reality check...

1. I have a html page with an image map and area names ("hot spots") for each of the printers on a given floor e.g.

AREA SHAPE="RECT" COORDS="152,346,210,403" HREF="vbsMapPrinter.vbs">

2. I have a vbscript file stored in a folder which can map a printer

Option Explicit

'** Define Variables and Objects **
Dim netPrinter, UNCpath

'** Set Variables and Objects
UNCpath = "\\Server\PrinterName"
Set netPrinter = CreateObject("WScript.Network")

'** Actually do the mapping

netPrinter.AddWindowsPrinterConnection UNCpath

etc

Ideally I would like to parameterise the vbscript to take a string such as "Servername\Printername" (or indeed \\Printer) so that I don't have to have multiple vbscripts (1 per printer) but instead have a single generalised routine which somehow takes the printer UNC from the "hotspot" on the webpage map

As it stands I still get the File Download Open dialog and the Run dialogs so I imagine this complicates grabbing any parameter

Is what I want to do possible? If so how do I do it?

Thanks a lot for any help you can give
Kinch

AdamGundry
03-15-2005, 12:14 PM
You could do it with a server-side language such as PHP, by creating a script that returns your VBS file but with the variable you want customised read from a GET parameter. You'd have to be a bit careful with security, though. What language(s) do you have available on your server?

Adam

Kinch
03-16-2005, 06:09 AM
Hi
I'm afraid it seems I am limited to Microsoft technologies only - does this mean I'm screwed?

Thanks
Kinch

AdamGundry
03-16-2005, 09:35 AM
<response type="biased">Yes, yes it does.</response> :D

No, you could also use ASP or a similar Microsoft technology, as long as it is available on your server. I don't know any ASP, though, but I'm sure you could get some help in the ASP forum.

Adam

Kinch
03-16-2005, 10:39 AM
ok - will do
cheers
Kinch