Page 1 of 1 1
Topic Options
#136510 - 2005-03-28 02:39 AM default printer not ticked
briannz556 Offline
Getting the hang of it

Registered: 2002-05-03
Posts: 64
Loc: new zealand
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.

Top
#136511 - 2005-03-28 02:52 AM Re: default printer not ticked
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please use code tags when posting to preserve indenting.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#136512 - 2005-03-28 10:01 AM Re: default printer not ticked
briannz556 Offline
Getting the hang of it

Registered: 2002-05-03
Posts: 64
Loc: new zealand
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


Top
#136513 - 2005-03-30 12:00 PM Re: default printer not ticked
briannz556 Offline
Getting the hang of it

Registered: 2002-05-03
Posts: 64
Loc: new zealand
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

Top
#136514 - 2005-03-30 12:05 PM Re: default printer not ticked
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22344
Loc: OK
hmm...
how you know it's not kix issue?
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 271 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.032 seconds in which 0.012 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org