I have an AppleScript:
on run
set pathName to "/Users/Alexander/Documents/GeekTool/DiskCapacityMeter"
set usedSpace to (do shell script "df -hl | grep 'disk0s2' | awk '{sub(/%/, \"\");print $5}'") as integer
set theNumber to (round (usedSpace / 5)) * 5
do shell script ("cp " & pathName & "/img/" & theNumber & ".png " & pathName & "/temp.png")
end run
(downloaded from: Here)
I wanna change this script to show my CPU usage instead of my disc capacity, and since i really don’t know any AppleScript, i have no clue how to change it.
I just know i need to change this part:
(do shell script "df -hl | grep 'disk0s2' | awk '{sub(/%/, \"\");print $5}'")
to give me my CPU usage instead of my disc capacity.. if it’s even possible to get my CPU usage this way?
edit*
There are 11 picures associated with this script (0-10.png) and a twelfth picture (temp.png) that changes to one of the first 11 depending on the number generated by the script.
I don’t know how accurate this is, but the CPU usage at single points of time has a lot of variance:
This would be even less accurate, because top itself uses a lot of CPU: