Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

external applications - system?

by Reverend Phil (Pilgrim)
on Feb 18, 2002 at 20:01 UTC ( [id://146235]=perlquestion: print w/replies, xml ) Need Help??

Reverend Phil has asked for the wisdom of the Perl Monks concerning the following question:

Possibly OT a bit, as the specific problem appears to be with Acrobat Reader on Win32...

Acrobat Reader has some unsupported command line functionality. Among the few commands is the following:
acrord32 /t <file> <printer> <print-driver> <portname>
..which should open the application iconized, print the document, and close the application. This is supposed to mimic the functionality that you get by dragging and dropping a PDF onto your printer icon. Unfortunately, I've tried with version 5.0 on Win2k and WinNT 4.0, and the application will print but not close (via drag-and-drop or command line).

Now we get to the perl. I'm playing around in Tk, and I'd like to have an event trigger off the printing of a PDF that I've generated. I've tried using system, but it waits for your command to complete, and as the application does not close, it waits and waits and waits.
I'm looking for a way to spawn this application and not care two bits about its completion. Any suggestions?

-=rev=-

Replies are listed 'Best First'.
Re: external applications - system?
by particle (Vicar) on Feb 18, 2002 at 20:19 UTC
    you might want to take a look at ALRMing behavior on Win32. i've just (two minutes ago!) written a Win32 substitute for unix's alarm functionality. i think you'll find it quite useful for your purposes.

    ~Particle

Try fork()?
by Kozz (Friar) on Feb 18, 2002 at 20:37 UTC
    You could also just fork() the process into the background.
external applications on Win32 - Win32::Process
by Rex(Wrecks) (Curate) on Feb 19, 2002 at 01:46 UTC
    Look up use Win32::Process ; at ActiveState. This should do what you need.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
      looks like the way to go =) thanks a ton.
        I am trying to do something very similar to what you describe, and read this thread with great interest, then chased off to investigate Win32::Process... Only to have Komodo show a compile error any time I added "use Win32::Process;" to a script. That's right, before I even place a call to it, just the invocation is sufficient. perl -cw script.pl will say all is OK, so it looks like a bug in Komodo. I am just looking to see if anyone else has seen this happen? As a novice, I trust Komodo's warnings (maybe more than I should), and wanted to see if anyone else had encountered this.
        Michael Gucciard
        Novice Perl Programmer

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://146235]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-03-28 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found