Results 1 to 6 of 6

Thread: Events with VBScript

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Question

    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

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Talking

    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.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50
    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

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Thumbs down

    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

  5. #5
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    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?

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Thumbs up

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width