#21775 - 2002-05-17 05:39 PM
installing printers
|
bluesteel
Fresh Scripter
Registered: 2002-05-13
Posts: 32
Loc: Montreal, Quebec Canada
|
hi all again,
i want to add printers in the login script using kixtart. I want to first check what group the
user is in, if he is in the right group to then install the printer(s) only if not already there.
Now, do i need nested ifs for this, or is there an easier way?
I thought i had something, but now im just drawing a blank.
thx blue [ 17 May 2002, 17:39: Message edited by: bluesteel ]
|
|
Top
|
|
|
|
#21777 - 2002-05-17 05:56 PM
Re: installing printers
|
bluesteel
Fresh Scripter
Registered: 2002-05-13
Posts: 32
Loc: Montreal, Quebec Canada
|
thx alot....thats what i figured.....but then i was getting confused trying to incorporate to many ifs........thx again
|
|
Top
|
|
|
|
#21778 - 2002-05-17 06:06 PM
Re: installing printers
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
It depends how many printers you have. what I am doing is create a .INI file that lists the printer and the groups that map to that printer. I then loop through the printer list and check whether that particular user is part of a group that need the printer mapped. Sounds complicated but in the end you have soemthing like 15 lines of code plus the .INI file. Here's an example: code:
; PRINTERS.INI [Printer1] Server=Server1 Groups=GroupA, GroupB
code:
$printers=readprofilestring('printers.ini','','') for each $printer in $printers $mapprinter=0 $groups=readprofilestring('printers.ini',$printer,'Groups') $groups=split($groups,',') for each $group in $groups if ingroup($group) $mapprinter=1 endif next if $mapprinter $server=readprofilestring('printers.ini',$printer,'Server') $rc=addprinterconnection('\\'+$server+'\'+$printer) endif next
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 884 anonymous users online.
|
|
|