Page 1 of 1 1
Topic Options
#75088 - 2003-05-20 09:01 PM If Printer exists question
Shaggydog Offline
Fresh Scripter

Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
Hi Everyone,
I'm new to this board, and I've done enough searching through your postings to know that you guys are pretty cool and you know your stuff.
I don't.

What I'm looking to do here at work is create a script for each location that will add the appropriate printers and drive mappings. I figured out how to do that quickly, but what I would like to do from here is develop an If statement that searches to see if the printer already exists in the profile, and then skip by that section of code, saving time for the user of course.

what I have now is simply this

Addprinterconnection ("\\myserver\WinLexT612")

use f: "\\myserver\Global Users"

What can I do to check to see if that printer connection already exists?
Thanks guys.
Shaggy

Top
#75089 - 2003-05-20 09:08 PM Re: If Printer exists question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
see www.gwspikval.com/jooel/UDF

there is primapstate() UDF

with it you can do:
code:
if not primapstate("\\myserver\myprintersshare")
addprinterconnection(...)
endif

_________________________
!

download KiXnet

Top
#75090 - 2003-05-22 09:31 PM Re: If Printer exists question
Shaggydog Offline
Fresh Scripter

Registered: 2003-05-20
Posts: 31
Loc: Mississauga, ON
Alright, I'm getting a good understanding for the code implied.
When I went to the UDF section and read up about this, there was alot more complicated code.

Anyways, I tried simply inserting the code you gave me, changing the names appropriately, but haven't come to any success.

Do I have to declare a function called primapstate and then call it later on?

Top
#75091 - 2003-05-22 10:04 PM Re: If Printer exists question
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, easiest is to insert the code found in there into your script file somewhere.

then you can use the code shown above.

the code from the site is "function definition" which tells kixtart what "function primapstate" is.

once it's in your script-file, you can use it as any other kixtart function.
_________________________
!

download KiXnet

Top
#75092 - 2003-05-22 10:28 PM Re: If Printer exists question
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
See the FAQ, How to use UDFs, for more information on using functions in your script. [Smile]
Top
Page 1 of 1 1


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

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.05 seconds in which 0.021 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