Problems when printing in 2 paralel automated word sessions.

R

Rudy Van Eeckhout

Hello all,

I do have several perl scrips whicht opens by ole an word instance
which is used to print a document to a certain printer. Now we noted
that these documents sometimes appear on the wrong printer. After some
investiation is did seen next effect.
First assume next script


my $Word= Win32::OLE->CreateObject('Word.Application', 'Quit');
$openWord->{'Visible'} = 0;
$Word->{ActivePrinter} = "$printer";
<STDIN> ; #Wait for a cariage return
print $Word->{ActivePrinter} ."\n" ;


When i run this script with $printer set to printerA and i do wait to
give a cariage return until i did run the script in a second form with
$printer set to printerB. The both script will print as active printer
printerB. This means that the assingment of Activeprinter is done for
all instances which are running.


Even when you try this manualy by opening 2 word sessions you can see
that the printer changes over the different sessions.


If you start msword from the command line with the /w option the
problem disapears.
Now i can not find out how to do this over perl OLE.


Is there anybody who knows how to solve this over OLE?


Kind regards.


Rudy.
 
C

Cindy M.

Hi Rudy,
When i run this script with $printer set to printerA and i do wait to
give a cariage return until i did run the script in a second form with
$printer set to printerB. The both script will print as active printer
printerB. This means that the assingment of Activeprinter is done for
all instances which are running.
Yes, changing the ActivePrinter in Word changes the default printer for
Windows, and will "of course" change the printer for all instances of
Word.

If you turn background printing in Word OFF
(Application.Options.PrintBackground = false) then all print jobs should
be processed synchronously, rather than asynchronously.

As I recall, there's also an old WordBasic command you can use to change
the printer that won't change the Windows default printer. Not sure how
using it will affect other Word documents, though. You should be able to
find the old WordBasic command in an article on word.mvps.org

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top