Just to get you started, have a look at these pages:
AHK fetches stuff from WMI :
Autohotkey forumQuery WMI for process attributes:
Microsoft Social forum (Check the answer)
You'll have to call that repeatedly (few times per second ? ), so you'd probably best limit the 'select *' to something like 'select PercentProcessorTime from Win32_PerfFormattedData_PerfProc_Process where Name=<yourprocessname>'
('where' clause does support Name like 'firefox%' etc.)
Use NirSoft's
Simple WMI View to determine the Name (or IDProcess) used by your process, and desired attributes to form a comma-separated list instead of just PercentProcessorTime (and improve response time).
NB: Using WMI from AHK through COM will perform (much) better than exporting to text file from SimpleWMIView and processing that text file...
Edit:
Use
WMI Explorer (Free for non-commercial use) to test your queries.
Edit 2:
WMI Explorer with this query:
select Name,PercentProcessorTime ,IDProcess,ElapsedTime,VirtualBytes,WorkingSet from Win32_PerfFormattedData_PerfProc_Process where Name like '%firefox%'