#116198 - 2004-03-16 04:26 PM
Re: Printto() Problems
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Well, this simple example works for me: Code:
funPrintByExtension("foo.txt") Function funPrintByExtension($sFileName) Dim $oShell $oShell=CreateObject("Shell.Application") $oShell.ShellExecute($sFileName,"","","print",1) If @ERROR "Error in open: "+@ERROR+": "+@SERROR+@CRLF Exit @ERROR EndIf EndFunction
This prints the file "foo.txt" to my default printer via notepad.
Change the "1" at the end of the line to "0" to hide the notepad window.
|
|
Top
|
|
|
|
#116199 - 2004-03-16 04:32 PM
Re: Printto() Problems
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
And this works using "printto"... Code:
funPrintByExtension("foo.txt","\\SGBUKLHD2K001\HMIUKLHDPR201") Function funPrintByExtension($sFileName,$sPrinter) Dim $oShell $oShell=CreateObject("Shell.Application") $oShell.ShellExecute($sFileName,$sPrinter,"","printto",1) If @ERROR "Error in open: "+@ERROR+": "+@SERROR+@CRLF Exit @ERROR EndIf EndFunction
|
|
Top
|
|
|
|
#116204 - 2004-03-16 05:23 PM
Re: Printto() Problems
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
There is a problem with that "join".
I'm pretty sure it should be: Code:
$_=join($_,"\")
|
|
Top
|
|
|
|
#116206 - 2004-03-17 10:00 AM
Re: Printto() Problems
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
No chance at all 
I'm running on XP Pro SP1.
Did you fix the join?
I've just tried again with a Word document on a remote file and it has worked fine.
If you pass invalid values for the document and printer, so you get any errors?
Does it work if you just use the "print" method rather than "printto"?
As a sanity check, here are my RTF printto parameters:
- APPLICATION = "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" /n /dde
- DDE MESSAGE = [REM _DDE_Minimize][FileOpen("%1")][FilePrintSetup "%2 on p",.DoNotSetAsSysDefault=1][FilePrint 0][DocClose 2][FilePrintSetup ""]
- APPLICATION = WinWord
- DDE APPLICATION NOT RUNNING = [FileOpen("%1")][FilePrintSetup "%2 on p",.DoNotSetAsSysDefault=1][FilePrint 0][FileExit 2]
- TOPIC = System
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
|