Page 1 of 2 12>
Topic Options
#22913 - 2002-06-11 07:05 PM Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
Hey all.. new to the board, I just picked up Kixtart and I'm having a couple of simple (I imagine) problems.

First off,

I cannot seem to get my Kixtart (V4.02) to set a Default Printer.

Here are the lines I'm using..

If AddPrinterConnection ("\\hercules\4050") = 0
? "Added printer connection...."
sleep 1
If SetDefaultPrinter ("\\hercules\4050") = 0
? "Set default printer to HP LaserJet 4...."
sleep 1
Endif
Endif

I'm doing the sleeping just so I can read the added printer connection message, I never get the set default printer message and it doesn't seem to work either. All Win2K network.

Also, I can't find a simple way to delete all connections. Do I have to list every printer on my network in statements to delete them all? That would take quite a bit; I'm sure there must be a command for deleting everything.

Pre-Thanks to any help I get!

Top
#22914 - 2002-06-11 07:11 PM Re: Default Printers and Deleting help needed
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please try this and report back. This will print out error messages if there are any.
code:
If AddPrinterConnection ("\\hercules\4050") = 0
? "Added printer connection...."
sleep 1
If SetDefaultPrinter ("\\hercules\4050") = 0
? "Set default printer to HP LaserJet 4...."
sleep 1
ELSE
? ''+@ERROR+' - '+@SERROR
sleep 1
Endif
ELSE
? ''+@ERROR+' - '+@SERROR
sleep 1
Endif

_________________________
There are two types of vessels, submarines and targets.

Top
#22915 - 2002-06-11 07:24 PM Re: Default Printers and Deleting help needed
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Are you using the share name?

I believe you can delete all printer connections with DeletePrinterConnection("").
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#22916 - 2002-06-11 07:37 PM Re: Default Printers and Deleting help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
you can also try http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=12;t=000207
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#22917 - 2002-06-11 08:23 PM Re: Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
Sealeopard,

I put the error statements in..

It came back with
2- The system cannot find the file specified.

I get the added printer connection first, then that error. I'm not sure why it's giving me trouble.

The delprinterconnection ("") does work. Thanks!

Top
#22918 - 2002-06-11 08:46 PM Re: Default Printers and Deleting help needed
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
It sounds like the drivers for the printer are not getting installed correctly. Does the error happen if you log in under a user account thta has local administartive privileges, too? Or just with regular users? Try loggin in as a domain administrator. Might be a user rights problem.
_________________________
There are two types of vessels, submarines and targets.

Top
#22919 - 2002-06-11 08:51 PM Re: Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
I'm actually just trying to get this to run on my PC right now. I am administrator of the PC itself as well as my network account having Domain Administrator privileges.

I tried to steal someone else's script and plug my own server/share names in to see if perhaps I was mistyping something, but I couldn't get there's to set the default printer either. Perhaps there is some kind of problem with V4.02 and Win2k? Is anyone using Win2000?

I see there is a new version 4.10, but I didn't choose it due to the fact that it is in beta. Maybe I should give it a try.

Top
#22920 - 2002-06-11 09:16 PM Re: Default Printers and Deleting help needed
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there was other topic discussing same type problem a while ago.
anyways, there is no thing between kix4.02 and w2k.
actually the version 4.* is best ran on w2k.

I can't memorize the last thread, but you could check on it via search.
_________________________
!

download KiXnet

Top
#22921 - 2002-06-11 09:26 PM Re: Default Printers and Deleting help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'm running 4.02 on win2k (nt4 network)

it works fine for me (I'm using the udf)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#22922 - 2002-06-11 09:30 PM Re: Default Printers and Deleting help needed
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Can you manually connect to the network printer and set it as the default printer? As user and/or as administrator?

It sounds as if KiXtart itself or the script that you are using are not the actual problem, but that there is something wrong on that workstation. Are users allowed to install printer drivers? This can be restricted on a per-workstation level.
_________________________
There are two types of vessels, submarines and targets.

Top
#22923 - 2002-06-11 10:28 PM Re: Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
Yes, I can manually add the printer.. through control panel- printers. It's really strange.. I can delete all of the printers and then add the printer I want as default first (defaulting it to default), but I would rather have it work correctly.

BTW we are all win2k and 2000 server

Top
#22924 - 2002-06-11 10:54 PM Re: Default Printers and Deleting help needed
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Could you also check the printers name.
I'm not sure if this will work in your case but in some cases printers sharename is different than the printers name on the server side.

so if this is your case, could you try with syntax:
\\servername\printername

instead of sharename...
_________________________
!

download KiXnet

Top
#22925 - 2002-06-11 10:59 PM Re: Default Printers and Deleting help needed
Schuliebug Offline
Hey THIS is FUN
*****

Registered: 2002-01-18
Posts: 379
Loc: Netherlands
Have you tried to set the default printer this way:
code:
If AddPrinterConnection ("\\hercules\4050") = 0
? "Added printer connection...."
sleep 1

$RC= SetDefaultPrinter ("\\hercules\4050") = 0
If @Error=0
? "Set default printer to HP LaserJet 4...."
sleep 1
ELSE
? ''+@ERROR+' - '+@SERROR
sleep 1
Endif
ELSE
? ''+@ERROR+' - '+@SERROR
sleep 1
Endif

It seems to me that this is the difference between your code and Radimus' code [Wink]
_________________________
Kind regards,

Top
#22926 - 2002-06-12 03:38 PM Re: Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
Hmm, I checked all of my Printer share names and I seem to be using the correct shares. I've tried quite a few different printers.

Schuliebug,

I'm basically using the same format as Radius. I made a couple small changes, and I don't know what the $rc variable is.

Also, one of our consultants was nice enough to allow me to borrow a kixtart script that another client was using. I changed a couple of the Printer names to my companies server/shares and it is not mapping the default printer either.

Below is a copy of the scripting..

At (10,20) @fullname
At (12,20) "Please Wait For Logon Script Execution"
At (26,20) " "
At (28,20) "Mapping your Common Directory and Printers"
sleep 2

If ADDPRINTERCONNECTION ("\\hercules\4050") = 0
? "Added printer connection to \\hercules\4050"
Endif

;If ADDPRINTERCONNECTION ("\\pdc01\pb_acctserv_tst") = 0
;? "Added printer connection to \\pdc01\pb_acctserv_tst"
;Endif

;If ADDPRINTERCONNECTION ("\\pdc01\pb_shipping_tst") = 0
;? "Added printer connection to \\pdc01\pb_shipping_tst"
;Endif

;If ADDPRINTERCONNECTION ("\\pdc01\pb_shiptwo_tst") = 0
;? "Added printer connection to \\pdc01\pb_shiptwo_tst"
;Endif

If ADDPRINTERCONNECTION ("\\backup\accounting") = 0
? "Added printer connection to \\backup\accounting"
Endif

If SetDefaultPrinter ("\\backup\accounting") = 0
? "Set default printer to Accounting...."
Endif

Return

I modified this to add //backup/accounting, and //hercules/4050 which are both my printers. The rest of the lines I REM'd.. those we're the pre-existing printers from the other company.

Top
#22927 - 2002-06-12 03:56 PM Re: Default Printers and Deleting help needed
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jhawk,
do not use sharenames in your defaultprinter-calls if they do not work.
check what is the printers name and use it.
addprinterconnection("\\server\printer_SHARE")
setdefaultprinter("\\server\printers_NAME")

and check if it works.

this is the way I use it and it works.
_________________________
!

download KiXnet

Top
#22928 - 2002-06-12 03:56 PM Re: Default Printers and Deleting help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
use the UDF... even for testing purposes.
Then verify the printer is connected
delete the printer and map it again with the UDF

If that works, then it is your code.

If it doesn't, then it could be the rest of your code, permissions to the machine or the printer, printer drivers available on the server, etc.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#22929 - 2002-06-12 04:03 PM Re: Default Printers and Deleting help needed
Jhawk Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 12
Loc: KS
Lonkero,

You are the *man*!! Calling by the printer name as opposed to the share works! [Razz]

At least it did this time! I will try to produce my whole script or at least a much larger version (i'm using ingroup to seperate departments)

It seems like the case may be solved, thanks to all for the help!

Top
#22930 - 2002-06-12 04:07 PM Re: Default Printers and Deleting help needed
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Damn. We really need to put this into the FAQ. I now remember that there were already a couple of posts about this same problem. Difference between printer name and printer share name, sometimes thay are not the same.

Grrrr....
_________________________
There are two types of vessels, submarines and targets.

Top
#22931 - 2002-06-12 04:11 PM Re: Default Printers and Deleting help needed
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes and then we could use again moderator language... rtfm...
_________________________
!

download KiXnet

Top
#22932 - 2002-06-12 06:03 PM Re: Default Printers and Deleting help needed
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I did drop the hint with my question "Are you using the share name?" but got no answer and you guys were having sooo much fun with it...

(don't you hate when someone says "I told you so"?) [Big Grin]

The lesson here is you should use the same name for printer and share.
_________________________
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 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.07 seconds in which 0.023 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