#147558 - 2005-09-15 03:04 PM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
sorry , wil try on another post cause here , i've take off (uninstall ?) the default printer (microsoft default printer) and can't put it back..
|
Top
|
|
|
|
#147559 - 2005-09-15 03:54 PM
Re: printer add: need help...
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
lets go back up please. did you test at all why some of the scripts didn't work? you must try to understand what is going on. I mean, the script commands are clear english words so it won't be that hard.
you say your edited code worked but it looks to me just the same as my code. tell me what this throws on your window: Code:
break on
if substr(@wksta,1,3) = "PTE" "part of PTE" ? $Room = substr(@wksta,4,4) "Room = " $Room ? if substr($Room,1,1) = "0" "Room started with zero, removing it." ? $Room = substr($Room,2) "Room is now " $Room ? endif "Connecting to Printer '\\PTE0705A06\HP"+$Room+"' " $retval = AddPrinterConnection("\\PTE0705A06\HP"+$Room) @error ? $retval = SetDefaultPrinter("\\PTP0705A06\HP"+$Room) endif
the default printer... well, you need to know the printers name and use it instead of the share name if they are different.
_________________________
!download KiXnet
|
Top
|
|
|
|
#147560 - 2005-09-15 04:07 PM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
Code:
ERROR : unknown command [Sleeping]! Script: C:\Documents and Settings\lionel\Bureau\KiX2010_450\KiX2010.450\kixtart. kix Line : 7
got this error when i try this one: Code:
break on
if substr(@wksta,1,5) = "PTE07"; $retval = AddPrinterConnection("\\PTE0705A06\HP705") $retval = SetDefaultPrinter("\\PTE0705A06\HP705") ?@error @serror ?Sleeping for 5 seconds..... Sleep 5
endif
Any idea ?
|
Top
|
|
|
|
#147563 - 2005-09-15 04:28 PM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
Quote:
part of PTE Room = 0706 Room started with zero, removing it. Room is now 706 Connecting to Printer '\\PTE0705A06\HP706' 1801
Don't work at all...only got this message..
|
Top
|
|
|
|
#147569 - 2005-09-16 10:35 AM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
Quote:
D:\KiX2010.450>kix32.exe kixtart.kix
2Le fichier spécifié est introuvable. <- can't find the file....but wich file ? Sleeping for 5 seconds..... D:\KiX2010.450>
Here what i've got when i try the following code: Code:
break on
if substr(@wksta,1,5) = "PTE07"; $retval = AddPrinterConnection("\\PTE0705A06\HP705") $retval = SetDefaultPrinter("\\PTE0705A06\HP705") ?@error @serror ?"Sleeping for 5 seconds....." Sleep 5
endif
The printer connect , but not as default..
BAL.
|
Top
|
|
|
|
#147570 - 2005-09-16 11:37 AM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
damn i think that's my error came frome the name of the printer in the SetDefaultPrinter line ! but can't find the name to put....isn't supposed to be the share name ? \\server\printer ? like here -> \\PTE0705A06\HP705 ?? Heres the script i use @ this moment: Code:
break on
if substr(@wksta,1,5) = "PTE07" "part of PTE" ? $Room = substr(@wksta,4,4) "Room = " $Room ? if substr($Room,1,1) = "0" "Room started with zero, removing it." ? $Room = substr($Room,2) "Room is now " $Room ? endif "Connecting to Printer '\\PTE0705A06\HP705" $retval = AddPrinterConnection("\\PTE0705A06\HP705) @error ? $retval = SetDefaultPrinter("\\PTE0705A06\HP705") endif [/core]
All working fine except the last line setdefaultprinter..
BAL.
|
Top
|
|
|
|
#147572 - 2005-09-16 12:25 PM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
OK my script works fine , i must think about not to put SetdefaultPrinter BEFORE endif ...
Code:
break on
if substr(@wksta,1,5) = "PTE07" MESSAGEBOX ("Installation de l'imprimante HP705 en cours...veuillez cliquer sur OK", "printer", 64) AddPrinterConnection("\\PTE0705A06\HP705") @error ?
endif
MESSAGEBOX ("définition de l'imprimante par défaut HP705", "printer", 64) SetDefaultPrinter("\\PTE0705A06\HP705") @error ?
Here's my final code....last problem , don't work at all with old versions of kix32....so did u know how to translate the setdefaultprinter and addprinterconnection in old kix script ?
T.Y.
BAL.
|
Top
|
|
|
|
#147574 - 2005-09-19 12:35 PM
Re: printer add: need help...
|
balafrus
Fresh Scripter
Registered: 2005-09-12
Posts: 33
Loc: Belgium
|
ok sorry , my fault , my entire fault...
/auto slap...
In fact , i use a kixtart2.kix in a kixtart.kix and all works fine....if my computer's name is PTE06xxx -> call Kixtart2.kix , if it's name is PTE07xxx , call kixtart3.kix etc etc...and it work really fine...
Thanks a lot for all your help !
BAL.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 507 anonymous users online.
|
|
|