Click to See Complete Forum and Search --> : Events with VBScript
spyder
May 18th, 2000, 01:05 AM
Part I
I am trying to get a sub called when a person clicks on an image on a web page. Currently, i am Getting an error on the page.
<img src="some_image" language="vbscript" Onclick="call test">
anyway, you get the idea. Why Would I be getting the error?
Part II
Once this is working, I need to have The Script to do the following.
access the users printers, and see if it is installed.
If it is not installed, install it. ( for our intranet )
This is on a NT and 2000 network
Thanks for any help
Spyder
RealisticGraphics
May 20th, 2000, 03:39 AM
Part 1 is easy
<img src="some_image" Name="Img1" Onclick="test">
You do not need to define the language and you do not need the "Call" either, just the function or sub name. If you are wanting to do anything to image at all, you also need to name it. (Yes it can be done by using an image collection, but it's easier this way.)
Part 2:
Set WshNetwork = CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to oPrinters.Count -1
if oPrinters.item(i) <> printer then 'PrinterName
found = false
else
found = true
end
end if
Next
if found = false then
WshNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"
end if
This code will loop through the installed printers and if it doesn't find the one you are looking for it will install it. I.E. will not allow this if securities are set a certain way. Also, you must have Windows Script Host fully installed on each client machine.
Part 3:
Yeah, I know there was no part 3 but... The handle "Spyder" is probably not the best idea for a handle right now, especially in a VBscript forum. You know, with the LOVEBUG running loose and all of the other copycats.
spyder
May 21st, 2000, 11:36 PM
Thanks for the info. I will give it a test later today.
As for the "Spyder" thing, Unfortunately i had this before that thing came out. and it has generally been my nick name for the past 3 years here at work.
What luck huh?
Devin Knabenbauer
spyder
May 22nd, 2000, 02:28 AM
Hello again,
I have Downloaded and installed the Scripting Hosts 5.1 and I am still getting an error when the WshNetwork is set.
Is there another location that i could get this from, or is there a New Version that I am not aware of.
Thanks
Devin
RealisticGraphics
May 22nd, 2000, 07:06 AM
Well, the newest version is 5.1. Of course 5.5 is in beta testing.
What exactly is the error it is giving on the network object?
spyder
May 23rd, 2000, 12:16 AM
The Problem was with the EnumPrinterConnections and the createPrinterConnection Lines. I have Changed it to the Createwindowsprinterconnection and am Not Checking the If the printer is installed anymore ( hence no more Enum... is needed ) The CreateWindowsPrinterConnection does not creat Duplicates so the will work Fine for my use
What i have is Working Fine Now. Thanks For all the Help
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.