briannz556
(Getting the hang of it)
2005-03-28 02:39 AM
default printer not ticked

Hi there
Easter Monday and i shouldn't be at work (school) but i've an annoying issue regarding why a local printer is not showing as being the default printer (which is what i want). Can anyone help me please?

My log-on script contains the following function:
Function Printers()
; ### remove old network printer connections ###
DelPrinterConnection ("")

; ###set default printer ###
$RegDefaultPrinter=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device")

If $PCrecord[0,8]<>''
If $RegDefaultPrinter <> ''
If AddPrinterConnection($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,8])
EndIf
Else
If AddPrinterConnection($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,8])
EndIf
If SetDefaultPrinter($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't set default printer")
EndIf
EndIf
EndIf
; ### add rest of printers ###
For $printer = 9 to 12
If $PCrecord[0,$printer]<>""
If AddPrinterConnection($PCrecord[0,$printer]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,$printer])
EndIf
EndIf
Next
EndFunction

Network printers are read from fields 8 - 12 in a DB call. My workstations are tied down and are all W2000.

1: $RegDefaultPrinter always shows as an empty string

2: with no network printer settings, the locally attached printer does not show as the default i.e not ticked.

3: with field 8 empty but 9-12 containing values, the first network printer is selected as the default printer i.e ticked.

4. no errors are reported in my error log file.

Puzzled to say the least.


Les
(KiX Master)
2005-03-28 02:52 AM
Re: default printer not ticked

Please use code tags when posting to preserve indenting.

briannz556
(Getting the hang of it)
2005-03-28 10:01 AM
Re: default printer not ticked

So sorry, here is the indented code - I think

Code:

Function Printers()
; ### remove old network printer connections ###
DelPrinterConnection ("")

; ###set default printer ###
$RegDefaultPrinter=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device")

If $PCrecord[0,8]<>''
If $RegDefaultPrinter <> ''
If AddPrinterConnection($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,8])
EndIf
Else
If AddPrinterConnection($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,8])
EndIf
If SetDefaultPrinter($PCrecord[0,8]) <> 0
DbgMessage("Error"," - can't set default printer")
EndIf
EndIf
EndIf
; ### add rest of printers ###
For $printer = 9 to 12
If $PCrecord[0,$printer]<>""
If AddPrinterConnection($PCrecord[0,$printer]) <> 0
DbgMessage("Error"," - can't add " + $PCrecord[0,$printer])
EndIf
EndIf
Next
EndFunction



briannz556
(Getting the hang of it)
2005-03-30 12:00 PM
Re: default printer not ticked

This is not a Kix issue so will pull the query. Sorry for taking up both time and space.

Will investigate further but in other directions.

Thanks


LonkeroAdministrator
(KiX Master Guru)
2005-03-30 12:05 PM
Re: default printer not ticked

hmm...
how you know it's not kix issue?