#121847 - 2004-06-25 09:39 PM
Sending a file to printer
|
futte
Fresh Scripter
Registered: 2002-07-02
Posts: 49
Loc: Denmark
|
Hi everybody
I have found thes code in the UDF libaray : function PrintTo($_file,$_printer) dim $,$_ $_=split($_file,"\") if ubound($_) $_file=$_[ubound($_)] endif $_[ubound($_)]="" $_=join($_) $=createobject("shell.application") $.ShellExecute($_file, $_printer, $_, "printto", 0) exit @error endfunction
and tried it, but there are three things, if i'm sending a PDF file to a printer it also starts Acrobat reader and show the file there, Why ?
And one more thing if don't delete these 4 lines in the code, it wont work, what does these 4 lines do ? $_=split($_file,"\") if ubound($_) $_file=$_[ubound($_)] endif $_[ubound($_)]="" $_=join($_)
And the last thing, what does these two lines in the code means :
$=createobject("shell.application") $.ShellExecute($_file, $_printer, $_, "printto", 0)
Hope anybody can help me
|
|
Top
|
|
|
|
#121848 - 2004-06-25 09:45 PM
Re: Sending a file to printer
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
You can do the following pretty simply -
TYPE FILE.TXT > LPT1
Or
PRINT FILE.PDF > LPT1
What version of KiXtart are you running:
Quote:
$_=split($_file,"\") if ubound($_) $_file=$_[ubound($_)] endif $_[ubound($_)]="" $_=join($_)
Create an object for use..
Quote:
$=createobject("shell.application")
Execute the file to be printed..
Quote:
$.ShellExecute($_file, $_printer, $_, "printto", 0)
Thanks,
Kent
|
|
Top
|
|
|
|
#121849 - 2004-06-25 09:55 PM
Re: Sending a file to printer
|
futte
Fresh Scripter
Registered: 2002-07-02
Posts: 49
Loc: Denmark
|
Thanks for quick respons but.....
First I'm running version 4.22 og Kix
You say I can do it simple this way:
TYPE FILE.TXT > LPT1
Or
PRINT FILE.PDF > LPT1
but I need to print it to a networkprinter, can I do that in a simple way to ??
You said that this execute the file to be printed
$.ShellExecute($_file, $_printer, $_, "printto", 0)
What does these 3 parameters do in the line
$_, "printto", 0
Thanks
|
|
Top
|
|
|
|
#121851 - 2004-06-26 04:20 PM
Re: Sending a file to printer
|
futte
Fresh Scripter
Registered: 2002-07-02
Posts: 49
Loc: Denmark
|
Hey
Yes it's working fine with txt-files, but i need to print a PDF file too, is that possible ??
|
|
Top
|
|
|
|
#121853 - 2004-06-27 08:00 PM
Re: Sending a file to printer
|
futte
Fresh Scripter
Registered: 2002-07-02
Posts: 49
Loc: Denmark
|
Hi
Now it's all working, thanks a lot for the help :-)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|