Page 1 of 1 1
Topic Options
#173038 - 2007-01-22 08:49 AM ADDPRINTERCONNECTION does not work
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Hi all,
i have a problem with the ADDPRINTERCONNECTION command. I wanna map 2 Printers to a special group. Can someone post me the code here? I´ve tested so many codes but nothing works. How does it work to get an error when the connection to the printer is failed?

PS: Sorry for my bad english but i´m from germany

Best wishes

Backfight


Edited by backfight (2007-01-22 08:54 AM)

Top
#173040 - 2007-01-22 09:44 AM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Code:
;Script Options
If NOT @LOGONMODE
	Break On
EndIf
Dim $RC
$RC=SetOption("Explicit", "On")
$RC=SetOption("NoMacrosInStrings", "On")
$RC=SetOption("NoVarsInStrings", "On")
$RC=SetOption("WrapAtEOL", "On")
;Map Printer
If InGroup("GroupName")
	$RC = AddPrinterConnection("\\Servername\PrinterShareName")
EndIf

Top
#173041 - 2007-01-22 10:07 AM Re: ADDPRINTERCONNECTION does not work [Re: Witto]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Hello there,
thanks for the early answer. But it doesn´t work. What i´m making worng? What must be configured on the server so that that script work Coretly?

Thanks for your help

Best wishes

Backfight

Top
#173043 - 2007-01-22 10:38 AM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I've amended Witto's code so that it returns an error if the mapping fails:
Code:
;Script Options
If NOT @LOGONMODE
	Break On
EndIf
Dim $RC
$RC=SetOption("Explicit", "On")
$RC=SetOption("NoMacrosInStrings", "On")
$RC=SetOption("NoVarsInStrings", "On")
$RC=SetOption("WrapAtEOL", "On")
 
Dim $sPrintServer	$sPrintServer="ServerName"
Dim $sPrinterName	$sPrinterName="PrinterName"
 
;Map Printer
If InGroup("GroupName")
	$RC = AddPrinterConnection("\\"+$sPrintServer+"\"+$sPrinterName)
	If @ERROR "ERROR: Cannot map printer "+$sPrinterName+" on "+$sPrintServer+" Reason: ["+@ERROR+"] "+@SERROR+@CRLF EndIf
EndIf


Make sure that the printer name and the share name are identical on the print server, otherwise it will cause you problems.

Top
#173046 - 2007-01-22 11:29 AM Re: ADDPRINTERCONNECTION does not work [Re: Richard H.]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Yes! It works!Thanks a lot!

But there comes a beep! Does this mean there is an error?

Top
#173048 - 2007-01-22 11:58 AM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
now the only thing i need is the command to set one of the printers to default printer
Top
#173049 - 2007-01-22 12:13 PM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
All the commands is in the command reference.
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#173052 - 2007-01-22 12:46 PM Re: ADDPRINTERCONNECTION does not work [Re: Björn]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Yes but how to code it in this especial example?
Sorry but i´m a newbie in kixtart

Top
#173053 - 2007-01-22 01:44 PM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
$RC = SetDefaultPrinter("\\"+$sPrintServer+"\"+$sPrinterName)
Top
#173057 - 2007-01-22 03:20 PM Re: ADDPRINTERCONNECTION does not work [Re: Witto]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Ok and how do i get the printers removed?

Excample: Some user wanna login but he issen´t in a group that gets printers. But he get! How can i say this user must not get any printer?

Thanks 4 Help

Top
#173060 - 2007-01-22 05:22 PM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I do not get this one. Printers added with "AddPrinterConnection()" are added per user, not per computer.

DelPrinterConnection()

Top
#173091 - 2007-01-23 08:23 AM Re: ADDPRINTERCONNECTION does not work [Re: Witto]
backfight Offline
Getting the hang of it

Registered: 2007-01-22
Posts: 61
Loc: Germany
Some users without any dedicated printers get without any reason some printers from another group.

Excample: Group xy get the Printer HP Laserjet 5
Group ab get no Printer
If any user frome group ab is registrated he get without any reason
dedicated one printer from group xy

Hope you understand me right

Sorry 4 my bad english

Top
#173094 - 2007-01-23 10:11 AM Re: ADDPRINTERCONNECTION does not work [Re: backfight]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
There is always a reason. I don't understand it.
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
1 registered (Allen) and 382 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.064 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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