Jump to content
Macro Express Forums

How to determine if a program is actively running?


Eg6Xpm18cs
 Share

Recommended Posts

Hi all,

 

Is there an ME-based way to determine if a program is actively running compared to just being open?

 

Seems to me that obtaining the program's memory / CPU usage would be most straightforward.

 

Normally I get button / cursor status, or color pick a progress bar, etc., but in this case there's a big difference between active and resting memory usage so it'll be a reliable indicator.

 

Any comments appreciated.

Link to comment
Share on other sites

Thanks for the pslist / PSTools, but the usage is a bit over me.

 

Did you pass data from pslist to a text file or call up the cmd window first? I can send data to a text file from the cmd window using, for example: pslist -m iexplore -e >pslist.txt but not from Macro Express. Or is there a way to go from pslist straight to ME variables?

 

And then how to parse the data?.... by processing as a text file with ME then using Varible Modify String to extract the characters corresponding to the data columns of interest?

 

TIA for any guidance.

Link to comment
Share on other sites

Did you pass data from pslist to a text file or call up the cmd window first? I can send data to a text file from the cmd window using, for example: pslist -m iexplore -e >pslist.txt but not from Macro Express. Or is there a way to go from pslist straight to ME variables?

Use the command Program Launch, with these parameters:

Program/Path name: C:\WINDOWS\system32\cmd.exe

Program Parameters: /c xxx\pslist.exe yyy >zzz\Data.txt

where:

xxx is the fully qualified pathname where PsList.exe is located

yyy is the name of the process you want to monitor

zzz is the fully qualified pathname where you want to store the output file

And then how to parse the data?.... by processing as a text file with ME then using Varible Modify String to extract the characters corresponding to the data columns of interest?

I extract the entire contents of data.txt into a text variable, which looks like this:

Process information for PHT:

Name			    Pid Pri Thd  Hnd   Priv	    CPU Time    Elapsed Time
Uedit32		    6816   8   9  258  20892	 0:00:23.665    49:29:22.392

Then you could discard everything before the name of your process and extract the CPU time. Next time you run PsList, you'll compare the new value of CPUTime to the old. Aim to convert the CPU time to seconds,which will make the comparison easy.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...