I wish I knew AppleScript, because I want this!
I don't even know how to get the text in the circle..then I don't know how to use that circle for the other scripts..
Anybody have some good links on how to figure this stuff out?
Hi sorry for the late reply, I've not been around as I've been travelling for a couple of months. I get back home next week so if this post doesn't help I'll be happy to make a more comprehensive guide then.
I will assume from your other post that you figured out the text okay, and you seem to have the battery working. The itunes one also has its own instructions. (Note: I used the 95% and 100% images from the itunes geeklet because in the original they are red and I wasn't a fan, and I'm not a great image manipulator!)
I made copies of the DiskCapacityMeter folder in my chosen geektool directory, each with a copy of the images (this was a bad idea, when I get a second I'll be getting them to refer to a shared directory to save space). The scripts I simply changed the paths to their relevant folders, and changed the core of the script to get the information I wanted.
I'll run through the changes I made here:
For each one I'll post the script changes I made from the DCM.scpt, this is between setting the path name and when you round the number to 5 to get the right image.
CPU Usage/Temp
Code:
set percTotal to 0
repeat 5 times
set percIdle to (do shell script "top -l2 | grep \"CPU usage\" | tail -1 | awk '{sub(/%\\ i/, \"\\ \");print $7}'") as number
set percTotal to percIdle + percTotal
end repeat
set percAv to percTotal / 5
set perc to 100 - percAv
This takes the cpu usage 5 times and averages them, as you get very erratic values otherwise, and it's pretty meaningless.
For the temperature I used this command directly in the geektool pane:
Code:
/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor | awk '{sub(/ C/, "ºC");print}'
You'll need to install the app from
here. I can't remember the exact install process to get the terminal tools. The rest of the command just appends the degree symbol. You'll have to play around if you want Fahrenheit, I would probably just do the maths in the command line.
Fan Speed
Code:
set fanSpeed to (do shell script "/Applications/smcFanControl.app/Contents/Resources/smc -f | grep \"Actual speed\" | awk '{print $4}'") as integer
if fanSpeed < 2000 then
set fanSpeed to 2000
end if
set fanPerc to (fanSpeed - 2000) / 42
This gets the percentage of fan speed, the minimum on my machine is 2000 rpm, hence the maths. In practice the speed can drop as low as 1960 or so, which is why I set it to 2000 if it's less, otherwise it can't find the image for -5% etc.
The text is simpler, because you can just display the actual number.
Code:
/Applications/smcFanControl.app/Contents/Resources/smc -f | grep "Actual speed" | awk '{print $4}'
I already had
smcFanControl installed, but I can't remember if it required any more changes to use the terminal tools.
Memory Usage
Code:
set usedSpace to (do shell script "top -l1 | grep \"PhysMem\" | awk '{sub(/M\\ f/, \"\\ \");print $10}'") as integer
set usedPerc to (1 - (usedSpace / 8191)) * 100
This checks the memory usage twice, as the first reading is always way off, then gets the percentage used. You can modify this to get it to display what you want. Currently it takes the free memory and gets the percentage that way. That assumes active and wired memory are in use, while inactive and used memory are available. If you want to assume used memory as in use (which it technically is, but is still available if needed) then use the value for inactive memory instead. changing the "f" (for free) to an "in" (for inactive) should probably work.
Code:
top -l1 | grep "PhysMem" | awk '{sub(/M\ f/, " ");printf "%3.2f", (8191-$10)/1024;printf "GB"}'
This is the command for the text.
If you need any more help let me know. I didn't proof read this either so if it makes no sense I'll try to clarify. Finally, I'm no expert in geektool or apple script, and this is the first time I've used either, so no judging my possibly questionable methods!
P.S. Your name is hilarious!