+ Post New Thread
Results 1 to 10 of 10
Scripts Thread, Printer Script in Coding and Web Development; I am trying to get this printer script to work, but everytime i run it i get an error saying ...
  1. #1

    Join Date
    Dec 2005
    Posts
    453
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Printer Script

    I am trying to get this printer script to work, but everytime i run it i get an error saying needs End Select.

    Any advice would be great!!
    Attached Files Attached Files

  2. #2

    Join Date
    Aug 2007
    Posts
    38
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Printer Script

    are you using vbscript or something ? maybe vba ?
    and would you have a select case ?

    if so you need to add the end statment to it.

    i might be on a totally different track , sorry if i have misunderstood what you mean.

  3. #3

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,592
    Thank Post
    109
    Thanked 769 Times in 598 Posts
    Rep Power
    181

    Re: Printer Script

    Your first two case statements are missing their closing End Select

  4. #4

    Join Date
    Aug 2007
    Posts
    38
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Printer Script

    you do not have enough end selects
    you have missed two on the first two select case

  5. #5

    Join Date
    Aug 2007
    Posts
    38
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Re: Printer Script

    arr Ric_ you got there before my second reply. i had not noticed he attached the file on my first post.

  6. #6

    Join Date
    Dec 2005
    Posts
    453
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Printer Script

    Whern i run the script now i am getting

    Error


    Line 111
    Character 2
    Error = Expected 'End'
    Attached Files Attached Files

  7. #7
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    188
    Thank Post
    28
    Thanked 93 Times in 53 Posts
    Rep Power
    32

    Re: Printer Script

    The error is caused by the second Select Case (Left(computerName, 5)). If you get rid of this it should work (as it is identical to the first). E.g.

    Code:
    Select Case (Left(computerName, 5))
    
    	Case "W107A"
    		
    		WshNetwork.AddWindowsPrinterConnection "\\servername\W107A_in"
    
    	Case "W107c"
    
    		WshNetwork.AddWindowsPrinterConnection "\\servername\W107c_in"
    
    	Case Else
    		' WScript.Echo "No default printers added"
    
    End Select
    Iain.

  8. #8

    Join Date
    Dec 2005
    Posts
    453
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Printer Script

    Yes thank you very much!

  9. #9

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Printer Script

    I have a similar script that removes printers and then adds new ones based on location (taken from the computers container OU) works a treat here.

    PM me if you'd like to see it, made with a lot of help from the edugeek folks

  10. #10

    Join Date
    Dec 2005
    Posts
    453
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Printer Script

    When i login with a computername e257 i get the printers for e258

SHARE:
+ Post New Thread

Similar Threads

  1. A Printer Script
    By Ric_ in forum Scripts
    Replies: 164
    Last Post: 1st October 2010, 10:11 AM
  2. logon script for printer
    By ozzy in forum Scripts
    Replies: 6
    Last Post: 22nd November 2007, 03:03 PM
  3. Logon script & Printer script question.
    By Galway in forum Windows
    Replies: 3
    Last Post: 29th August 2007, 11:00 AM
  4. Add printer script not workling
    By mark in forum Windows
    Replies: 6
    Last Post: 15th September 2005, 10:07 AM
  5. Script to delete printer
    By tosca925 in forum Scripts
    Replies: 2
    Last Post: 31st August 2005, 07:45 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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