Page 1 of 2 12>
Topic Options
#142922 - 2005-07-05 10:32 AM delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
Hi,
I am new to Kix and as I am connecting printers I figured that if I got a mobiles user taking his laptop to different branches will end up with heaps of printer connections. So i was wondering if there is a way to delete all existing printer before connecting the one they need for the site?
I already searched arround and coulnd't fint anything - sorry if this was already covered.
Thanks for your help.
Kat

Top
#142923 - 2005-07-05 10:52 AM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
try:
delprinterconnection("")
_________________________
!

download KiXnet

Top
#142924 - 2005-07-05 10:53 AM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and this is in the manual.
on your search trip, I suggest you always include the manual to it, k?
_________________________
!

download KiXnet

Top
#142925 - 2005-07-05 11:05 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
Tried it and it is not working get an error code 30
Top
#142926 - 2005-07-05 11:06 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
besides I checked the manual ...

Edited by Kat (2005-07-05 11:06 AM)

Top
#142927 - 2005-07-05 11:07 AM Re: delete all printers before connecting new ones
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
30 says:

The system cannot read from the specified device.
 

Top
#142928 - 2005-07-05 11:13 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
yep, saw that. Is there a way to use a wild card?
I tried
deletePrinterConnection ("*")
deletePrinterConnection (*)
deletePrinterConnection ("\\*")
but nothing worked.
any ideas?

Top
#142929 - 2005-07-05 11:26 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
Ok it seems like I really have to read more carefully the manual as it it must be 'DelPrinterConnection' and not 'DeletePrinterConnection'.
Still now I am getting 1801 error which means that the printer cannot be found.
@ Lonkero: Sorry, if I sounded a bit harsh I am just trying now for 3 days to get this going.
Kat

Top
#142930 - 2005-07-05 11:43 AM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
kat, sure.
what more you try without success, that more tense you become and more mistakes you make, like with the name here
_________________________
!

download KiXnet

Top
#142931 - 2005-07-05 11:51 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
Thx,
this all gets worse as I am not very good in scripting anyway.
When I started I thought map some printers no problem and then I had to work out all kinds of stuff like how to determine in which subnet the user is ... Got that all running fine just cannot find I way to delete all printers first
At least I am getting now 'cannot find printer' which is better than the one error before.

Top
#142932 - 2005-07-05 11:56 AM Re: delete all printers before connecting new ones
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Which version of KiXtart are you using?
Top
#142933 - 2005-07-05 11:59 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
good question,

I just checked to make sure it's version 4.23.0.0

Top
#142934 - 2005-07-05 01:22 PM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
next question is, what version of kixtart you are using?
_________________________
!

download KiXnet

Top
#142935 - 2005-07-05 01:25 PM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
richie was faster.
and is there network printers available for it to demap?
_________________________
!

download KiXnet

Top
#142936 - 2005-07-05 01:36 PM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
yep, there are.
Top
#142937 - 2005-07-05 01:55 PM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, add this code at the end of your script:
Code:

function DelPrinterConnections()
dim $c,$bk,$conn
$c=0
$bk="HKEY_CURRENT_USER\Printers\Connections"
$conn=enumkey($bk,$c)
while @error=0
$c=$c+1
$conn=delkey($bk+"\"+$conn)
$conn=enumkey($bk,$c)
loop
endfunction



and, where you did call the delprinterconnection(""), replace it with DelPrinterConnections()
let us know did that work, k?
_________________________
!

download KiXnet

Top
#142938 - 2005-07-05 02:45 PM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
works so far fine just it deletes only 2 of the current 4 network printers. But I think I go ahead tomorrow as it is quite late here (10.30pm) and I have to be back to work at 8.30am.
Thx for the help - be back tomorrow and tell you how go.
Kat

Top
#142939 - 2005-07-05 02:48 PM Re: delete all printers before connecting new ones
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
2 was left?
so, I would concentrate on those two.
most likely they are the cause why kixtart's delprinterconnection is failing.
_________________________
!

download KiXnet

Top
#142940 - 2005-07-06 01:37 AM Re: delete all printers before connecting new ones
Kat Offline
Fresh Scripter

Registered: 2005-06-22
Posts: 15
Loc: Melbourne - Australia
Hi Lonkero,

got it going! All I needed to change on your function was the counter. It seems like the key numbering are going in .5 steps and not in 1. Therfore every second printer was skiped. I changed your counter $c=$c+0.5 and it works perfectly!

Thanks heaps for that! now I can start writing the rest.

Kat

Top
#142941 - 2005-07-06 04:38 AM Re: delete all printers before connecting new ones
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
LOL
Jooel won't admit there is anything wrong with his UDF. It deletes evey second printer because whenever a printer is deleted, it skews the index.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.076 seconds in which 0.026 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