Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

I wish to monitor and react according to windows "Task Manager"

by moked (Beadle)
on Dec 28, 2004 at 13:58 UTC ( #417768=perlquestion: print w/ replies, xml ) Need Help??
moked has asked for the wisdom of the Perl Monks concerning the following question:

I wish to monitor wondows "Task manager" and wait for a certain process to start.
after it starts I want to wait for it's end.
when the process ends I want to launch a script and return to the wait position again.
I want the perl script to run in the background all the time and consume as less CPU as it can.

Thanks

P.S.
it's my birthday today

Comment on I wish to monitor and react according to windows "Task Manager"
Re: I wish to monitor and react according to windows "Task Manager"
by edan (Curate) on Dec 28, 2004 at 14:01 UTC

    That's nice. Good luck. Please let us know how it goes for you.

    P.S. Happy Birthday.

    --
    edan

Re: I wish to monitor and react according to windows "Task Manager"
by Corion (Pope) on Dec 28, 2004 at 14:09 UTC
      I get an error about Win::OLE::const
      apearently one of the lines on the file is cousing an error
      I belive I am missing a file but I don't know which
      If any one can help?

        Where do you get the error? What is the exact text of the error? What is the exact code you are running?

        Please read How (Not) To Ask A Question.

        I will also need the exact version of Perl (perl -v tells you this). The Win32 modules do not work under any other operating system than Windows.

Re: I wish to monitor and react according to windows "Task Manager"
by blackadder (Hermit) on Dec 28, 2004 at 23:03 UTC
    I was gonna say use WMI as Corion pointed out or PSEXEC.....

    Blackadder
Re: I wish to monitor and react according to windows "Task Manager"
by DaWolf (Curate) on Dec 29, 2004 at 09:19 UTC
Re: I wish to monitor and react according to windows "Task Manager"
by moked (Beadle) on Dec 30, 2004 at 21:41 UTC
    OK
    I have managed to get another computer and I installed ActivePerl on it
    I installed al the moduls needed and I ran teh naxt code:
    #!/usr/bin/perl -w use strict; use Win32::OLE; use Win32::Process::Info; my $pi = Win32::Process::Info->new (undef, 'WMI'); print $pi; my @info = $pi->GetProcInfo (); # Get the max relationships. for (my $p = 0; $p < scalar @info; $p++) { if (!($info[$p]{'ProcessId'})) { $info[$p]{'ProcessId'} = ''; } if (!($info[$p]{'Name'})) { $info[$p]{'Name'} = ''; } if (!($info[$p]{'ExecutablePath'})) { $info[$p]{'ExecutablePath'} = ''; } my $pid = $info[$p]{'ProcessId'}; my $pnm = $info[$p]{'Name'}; my $pex = $info[$p]{'ExecutablePath'}; print "ID:$pid\tNAME:$pnm\tExPath:$pex\n"; }

    it runs and in the end I get the result I expect
    but in the middle I get many warnings like this:

    Use of uninitialized value in integer multiplication (*) at E:/Program Files/Per l/lib/Time/Local.pm line 76.
    Use of uninitialized value in pack at E:/Program Files/Perl/lib/Time/Local.pm li ne 67.
    Use of uninitialized value in pack at E:/Program Files/Perl/lib/Time/Local.pm li ne 67.
    Use of uninitialized value in integer addition (+) at E:/Program Files/Perl/lib/ Time/Local.pm line 67.
    Use of uninitialized value in integer addition (+) at E:/Program Files/Perl/lib/ Time/Local.pm line 76.
    Use of uninitialized value in integer multiplication (*) at E:/Program Files/Per l/lib/Time/Local.pm line 76.
    Use of uninitialized value in integer multiplication (*) at E:/Program Files/Per l/lib/Time/Local.pm line 76.

    and it is repetative
    Please Help !!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2014-12-19 16:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (86 votes), past polls