Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How print doc files in a row

by moklevat (Priest)
on Feb 29, 2008 at 03:02 UTC ( #671081=note: print w/ replies, xml ) Need Help??


in reply to How print doc files in a row

It may depend on how you are invoking Word. It looks like the following command line switches should work:

"c:\program files\microsoft office\office11\winword.exe" "c:\perl\test.doc" /q /n /mFilePrintDefault /mFileExit

Without seeing your code and a better description of what happens, this is the best I can do.


Comment on Re: How print doc files in a row
Download Code
Re^2: How print doc files in a row
by xiaoyafeng (Chaplain) on Feb 29, 2008 at 03:36 UTC
    Thanks!!;
    below is my snippet:
    my $dir; opendir ($dir, ".") or die "error!\n"; for my $file_name (readdir $dir) { next if $file_name =~ m/^\./; system("c:\\program\ files\\microsoft\ office\\office10\\winword.e +xe", "$file_name", "/q", "/n", "/mFilePrintDefault", "/mFileExit"); sleep 10; }

    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
      Not sure if that was a typo, but you have some back-slashes missing from your system call, should be:
      system("c:\\program\\files\\microsoft\\office\\office10\\winword.exe", + "$file_name", "/q", "/n", "/mFilePrintDefault", "/mFileExit");
      One option to stop the windows showing is to run the program with the C API CreateProcess and set the SW_HIDE attribute to the main Window, unfortunately it looks like Win32::Process does not support that.:(
        No, he's trying to escaping spaces. Rather silly, though, since "\ " is the same thing as " ". Good thing, too, since Windows wouldn't understand "\ " to mean space.

        If you wanted to hide the Window, you could use Win32::Process's CreateProcess instead of system.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://671081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-09-21 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls