Page 1 of 2 12>
Topic Options
#96242 - 2002-11-29 01:46 AM RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Here's a challenge for the midnight ramblers, severity level -4...
I'm looking for script ideas to send a test print job to a printer, if possible.
The Scenario...
Win2k/NT4 domain...
Printserver with about 300 printers is moving, getting a new static IP, blah, blah.
Project Plan requires a test print to all printers after move.
ATM, the plan calls for a manual 'print test page' from each printer and a gopher to the printer to retrieve the hard copy from each printer. [Roll Eyes]
I have created a KiX script to check the printer status for all printers before and after the move [Smile] but the doubters still want to see a hard copy from each printer.
Any and all brain pharts on scripting a test print to a networked printer are welcome.
[Oh yeah, they want this yesterday for the move this weekend.]
_________________________
We all live in a Yellow Subroutine...

Top
#96243 - 2002-11-29 05:25 AM Re: RFC - Send a print job from KiX ?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Would a COM Word.exe document work?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#96244 - 2002-11-29 06:06 AM Re: RFC - Send a print job from KiX ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I know you can drag and drop a document onto a printer icon and it will print. Doing it 300 times though would be a pain. Wonder if you selected them all...

Naw... won't work. Go with Howard COM.

[ 29. November 2002, 06:08: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#96245 - 2002-11-29 06:27 AM Re: RFC - Send a print job from KiX ?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Word COM script from Shawn: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=003254#000001

Not quite sure how to direct it to a specific printer.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#96246 - 2002-11-29 07:08 AM Re: RFC - Send a print job from KiX ?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
This maybe what you are looking for -

Win32_PrintJob.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#96247 - 2002-11-29 03:05 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Thanks a bunch, folks...
Looks like a definite maybe...
Migration pushed back/ahead? one week so lots of time...
Will report back with outcome...
Cheers...

[ 29. November 2002, 15:16: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#96248 - 2002-11-29 08:48 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why doesn't simple "print /d" do?
_________________________
!

download KiXnet

Top
#96249 - 2002-11-29 09:42 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Well, turns out to be much simpler than I expected it would be when I posed the challenge... [Smile]
Shawn's ole word code did the trick. For multiple printers, I'll just read an input file for share names and loop 'til done. Jooel's suggestion also works, for text files, in a shell/run context. Thanks once more to Shawn, Howard, Les, Kent, and Jooel for their brilliance and willingness to share it. [Big Grin]
FWIW, here's the basic test code...
code:
;test.kix
;print a word document to the default printer
;
$filename = "the_word.doc"
;
$printer = "\\the_print_server\the_printer_share"
;
If AddPrinterConnection ($printer) = 0
"Added printer connection "+$printer?
If SetDefaultPrinter ($printer) = 0
"Set default printer to "+$printer?
Else
"Set default printer error "+@error+" "+@serror?
Endif
Else
"Add printer error "+@error+" "+@serror?
Endif
;
$word = createobject("word.application")
;
If @error = 0
$word.visible = 1
$nul = $word.documents.open("$filename")
$nul = $word.activedocument.printout(0,0,0)
$word.quit
$word = 0
Else
"Word launch error "+@error+" "+@serror?
EndIf
;
If DelPrinterConnection ($printer) = 0
"Deleted printer connection "+$printer?
Else
"Delete printer error "+@error+" "+@serror?
Endif
;

Cheers...
_________________________
We all live in a Yellow Subroutine...

Top
#96250 - 2002-11-29 09:48 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh?
why not:
run "write /p $file"

it works also [Wink]
_________________________
!

download KiXnet

Top
#96251 - 2002-11-29 10:07 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Lonkero...
Have you been talking to my boss again?
Now they want to test print excel and visio documents as well... [Roll Eyes]
_________________________
We all live in a Yellow Subroutine...

Top
#96252 - 2002-11-29 10:15 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
whatta f**k?

"5% raise is needed for such a dummy job" is what I would say to him after asking me to something like that! [Cool]
_________________________
!

download KiXnet

Top
#96253 - 2002-11-29 10:24 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Exactly... [Wink]
"Don't applaud, throw money" is what I always say sometimes...
For reasons beyond me, they're all hung up about losing formatting [and a gazillion other print properties] when only the print server's location and IP address changes...
Have a good week-end...
_________________________
We all live in a Yellow Subroutine...

Top
#96254 - 2002-11-29 10:27 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz, don't go yet.

I have a script in 5 mins which prints whatever you want...
_________________________
!

download KiXnet

Top
#96255 - 2002-11-29 10:30 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this should do the job:
code:
$actionName="Print"
$file="whatever file you want to print"

$shell=createobject("shell.application")
$printer=$Shell.namespace($file).self

for each $action in $printer.verbs
if instr(join(split($action,"&"),""),$actionName)
$LinkDest.invokeverb(""+$verb)
endif
next

dunno about the actionname "print", should it be "printto" and/or should the instr be changed to real match check, but try it out.
_________________________
!

download KiXnet

Top
#96256 - 2002-11-29 10:54 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
I could see a UDF on the horizon... [Smile]
Stepped out for a cold Lapin Kulta... [Wink] and voila...
Just tried your code as is and nothing... [Frown]
Gotta go, will pick up on it next month...
_________________________
We all live in a Yellow Subroutine...

Top
#96257 - 2002-11-29 11:11 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
dude, where you live if you have seen that commercial???
_________________________
!

download KiXnet

Top
#96258 - 2002-11-29 11:13 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...on the dark side of the moon...
...don't know anything about the commercial, just the name of the wobbly pop...
_________________________
We all live in a Yellow Subroutine...

Top
#96259 - 2002-11-29 11:31 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I could check more on that and make it even a UDF...
_________________________
!

download KiXnet

Top
#96260 - 2002-11-29 11:38 PM Re: RFC - Send a print job from KiX ?
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
...so where's the best place to go for a Lapin Kulta...Amarillo?
_________________________
We all live in a Yellow Subroutine...

Top
#96261 - 2002-11-29 11:40 PM Re: RFC - Send a print job from KiX ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
finnish friends you got or what?
or just exploring the web?

amarillo is good place if you have age over 35.
it's almost clean as those clean hotel bars but is not related to hotel [Wink]
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


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

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

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