## Friday, February 28, 2014

### Getting the CPU load in a AutoHotKey / AHK script

I needed some way to easily obtain the load a specific process is causing, and I didn't want to use DLLs ore start other windows applications to get that data. So I did some digging and it turns out that wmic is able to report that percentage to you:

processtime( ProcessName )
{
runwait %comspec% /c wmic path Win32_PerfFormattedData_PerfProc_Process.name='%ProcessName%' get percentprocessortime > c:\tmp\out.txt,,hide