I had the same problem, when I had to add specific printers relevant to the classroom they are located, I managed after a lot or trial and error to come up with this.

;This function will accept the 3 parameters to add the printers
;The three parameters are $min=lowest numbered computer in the room
;$max is the highest numbered computer in the room
;$printer is the actual printer to be added


function Addprinter($min,$max,$printer)
for $count=$min to $max step 1
$class="$room"+"$count"
if instr($class,@wksta)
addprinterconnection("$printer")
endif
next
endfunction

;Example of workstation based PC's (bear in mind our pc's are named with a letter then a number, for example B1515)


List of printers served by printserver
;----------
$prtserver="\\keep"
;----------

$b21print="$prtserver\b21print"
$b23print="$prtserver\b2307"
$dtprint="$prtserver\dtprinter"
$b8printer="$prtserver\b8printer"
$b16laser="$prtserver\b16laser"
$b15printer="$prtserver\b15printer"
$b16colour="$prtserver\b16colour"
$6thformxerox="$prtserver\6thformxerox"
$libxerox="$prtserver\libxerox"
$a13print="$prtserver\a13print"
$hpfood="$prtserver\hpfood"
$it="$prtserver\itroom"
$artxerox="$prtserver\artxerox"
$fiery="$prtserver\fiery"
$l4="$prtserver\l4print"
$b6xerox="$prtserver\b4xerox"
$geogprint="$prtserver\geogprint"
$english="$prtserver\english"
$c2samsung="$prtserver\c2samsung"

Example of printer being added by computername

dim $class[14]
$room="b"
addprinter(2101,2115,$b21printer)

Hope this helps
_________________________
--
Regards