Eg6Xpm18cs Posted November 1, 2012 Report Share Posted November 1, 2012 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. Quote Link to comment Share on other sites More sharing options...
paul Posted November 2, 2012 Report Share Posted November 2, 2012 You can use pslist (http://technet.microsoft.com/en-us/sysinternals/bb896682.aspx) with the specified process id or name, and parse its output with ME to determine when a process is no longer continuing to consume CPU or memory resources. I used to do this for downloads so that I could sleep my computer at night once all downloads were finished. Quote Link to comment Share on other sites More sharing options...
Eg6Xpm18cs Posted November 2, 2012 Author Report Share Posted November 2, 2012 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. Quote Link to comment Share on other sites More sharing options...
paul Posted November 3, 2012 Report Share Posted November 3, 2012 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. Quote Link to comment Share on other sites More sharing options...
Eg6Xpm18cs Posted November 4, 2012 Author Report Share Posted November 4, 2012 Many thanks paul. Shared the macro here. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.