tjcarst
Hey THIS is FUN
Registered: 2003-09-08
Posts: 243
Loc: USA
|
No, you didn't miss anything.
I've since changed it as sealeopard suggested to use OSID.UDF.
But, I found a mistake in my code that was causing the one printer to repeatedly add. Now the script is adding the printers correctly based on computer group membership.
However, many computers have more than one printer, and I am having trouble setting the default one. The script uses computer group membership, and @primarygroup uses user group membership. If I could use the computer group membership and read the primary group of the computer to set the printer, I'd have things working.
I am beginning to think I should have done this using an .ini file. I have the files for all pc's already, I collected the currently installed printers and the default printer for each workstation+username combo. I could probably, after weeks of messing with the script, read the ini file and write the new printers to the pc's if they did not already exist.
Until just recently, I've never messed with Kix, and have no programming background beyond basic batch files, ini files, registry hacks, and a little html code. Nothing along the logic of programming. So, I am struggling and often do things that make no sense to you guys, rightly so.
I find it fascinating and continue to mess with it at home during non-work hours so I don't catch hell, but can't help but try to get this to work. I'm persistent and stubborn, so eventually, I'll get it. You guys have been wonderful with your patience and assistance. I apologize for asking what must be obvious to the experienced Kix programmer.
Currently I have the following script that adds the printers, but haven't figured out how to set default based on computer primary group membership:
Printer: Q-MIS Server: MRH-01 Group: Printer_MRH-01_Q-MIS
code:
call @ScriptDir+'\PriMapState.udf'
;********** Prevent script from running on a server or Win95********* if @userid = administrator call @Scriptdir+'\osid.udf' $os=osid() if $os[1]='Win95' or $os[2]<>'Workstation' exit 0 endif endif
;********** Beginning of printer mapping ********* $WS = GetObject("WinNT://" + @domain + "/" + @wksta + "$$") if @error ? @serror else for each $grp In $WS.Groups $GrpName = $grp.Name
if left($GrpName,8) = "Printer_" $printer = substr($GrpName,9) $printer = join(split($printer,"_"),"\")
if not PriMapState("\\" + $printer) ? "Status - Printer not connected "+$printer $S=AddPrinterConnection("\\" + $printer) ? "Status - Printer added "+$printer ? @serror ? endif endif next endif
edited to correct code [ 10. October 2003, 03:26: Message edited by: tjcarst ]
|