+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Help re-writing kix script to vbs? Maps printers... in Coding and Web Development; Hi clever, dark-art-of-scripting folks. Need to re-write a kix script in vbs, which maps printers for certain PCs in an ...
  1. #1

    Miscbrah's Avatar
    Join Date
    Dec 2011
    Posts
    910
    Thank Post
    251
    Thanked 256 Times in 155 Posts
    Rep Power
    115

    Question Help re-writing kix script to vbs? Maps printers...

    Hi clever, dark-art-of-scripting folks.

    Need to re-write a kix script in vbs, which maps printers for certain PCs in an interesting way.

    Each PC has a .pnt file (text file) in the netlogon\setprinters folder. The kix script searches the setprinters folder for the .pnt file which corresponds to the machine name, and maps printers accordingly.

    The script itself is:

    Code:
    ;CHECK FOR ADDITIONAL PRINTERS
    if open (1, "%LOGONSERVER%\netlogon\printers\" + @hostname + ".pnt", 2) = 0
    	$newfline = ReadLine(1)
    	$findex = 0
    	$lineno = 20
    	while @error = 0
    		$pntarray = split($newfline, "=")
    		if $pntarray[$findex] = "printer"
    			$findex = $findex + 1
    			$ERRH = AddPrinterConnection ($pntarray[$findex])
    			; Added by Bruce for DEBUG: 2006-09-07
    			if @Userid = "denise"
    				AT ($lineno,5) "Adding printer: " + $pntarray[$findex]
    				$lineno = $lineno + 1
    			endif
    		else
    			$findex = $findex + 1
    			$ERRH = SetDefaultPrinter ($pntarray[$findex])
    			; Added by Bruce for DEBUG: 2006-09-07
    			; AT ($lineno,5) "Setting default printer: " + $pntarray[$findex]
    			; $lineno = $lineno + 1
    		endif
    		$newfline = ReadLine(1)
    		$findex = 0
    	Loop
    endif
    $ERRH = close(1)
    And a sample .pnt file would be:

    Code:
    printer=\\pc1303\HumsOfficeLaser
    default=\\pc1303\HumsOfficeLaser
    printer=\\mcprint\a32
    Any ideas? I can do all this through GP of course, and indeed other ways, just wanted to know if it is possible to retain this .pnt file method.

    Thanks for absolutely any help!

  2. #2

    Miscbrah's Avatar
    Join Date
    Dec 2011
    Posts
    910
    Thank Post
    251
    Thanked 256 Times in 155 Posts
    Rep Power
    115
    Thanks for the EPIC pm mac_shinobi, but I couldn't reply as your inbox is full.

  3. Thanks to Miscbrah from:

    mac_shinobi (26th June 2012)

  4. #3

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,781
    Thank Post
    3,288
    Thanked 1,054 Times in 975 Posts
    Rep Power
    365
    edit : have space in my inbox now or you can reply here if you want
    @Steve21 is a lot better than myself with coding / scripts etc, I generally know what I need to look for / google for etc and can for the most part get it working although need to learn neater coding without any illegal bits etc

    Am sure he could knock something up a lot faster
    Last edited by mac_shinobi; 26th June 2012 at 02:34 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 1st July 2014, 08:34 AM
  2. Script to delete network printers at logoff?
    By dknight in forum Scripts
    Replies: 1
    Last Post: 8th May 2012, 11:11 AM
  3. Replies: 13
    Last Post: 22nd April 2011, 03:50 PM
  4. Help needed writing a pkinvoice script
    By Ric_ in forum Scripts
    Replies: 6
    Last Post: 20th April 2007, 12:15 PM
  5. Replies: 4
    Last Post: 25th December 2006, 09:15 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
  •