Jump to content

ruger42

ruger42

Member Since 26 Sep 2009
Offline Last Active Private
****-

Posts I've Made

In Topic: Need help with geektool scripting

09 August 2011 - 03:41 AM

...But that still leaves me with no battery percentage.

Since you don't have a laptop, I will look myself to fix that.

Thank you so much for all the help! :)

Glad to be of assistance, it was a fun learning experience...

Here's another script I found online that you can try for battery percentage:
ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}'
Unfortunately I think you're out of luck with Hotmail - in order to get the number of unread emails you'd need to use IMAP, but Hotmail doesn't support that protocol, only POP3 which (from what I've read) doesn't provide the necessary functionality to retrieve such information. You can always forward your Hotmail messages to Gmail... ;)

If you do manage to figure it out let us know!

In Topic: Not using all cores?

08 August 2011 - 08:36 PM

Double click on the CPU Usage meter and see what pops up...

In Topic: Need help with geektool scripting

08 August 2011 - 01:11 AM

Here's some more stuff I found online for RAM, CPU, and Battery:
#!/bin/bash

##Change the value of totalRAM to match the amount of memory in your computer   

   myRAM=`top -l 1 -F -R | awk '/PhysMem/ {print "" $8+0}'`
   totalRAM=8192
   myPercentRAM=`expr $myRAM \* 100 / $totalRAM`
   
   echo "RAM: $myPercentRAM%"
   
   
   myCPU=`top -l 2 -F -R | awk '/CPU usage/ && NR>5 {printf "%d", $7+0}'`
   myCPU=`expr 100 - $myCPU`
   
   echo "CPU: $myCPU%"
   
   
   ioreg=`ioreg -w0 -l | grep "ExternalConnected|CurrentCapacity|MaxCapacity" | awk '{print $5}'`
   my_ac_adapt=`echo $ioreg | awk '{print $1}'`
   max_power=`echo $ioreg | awk '{print $2}'`
   cur_power=`echo $ioreg | awk '{print $3}'`
   bat_percent=`echo "scale=2;$cur_power / $max_power" | bc`
   bat_percent=`echo "$bat_percent * 100" | bc | sed 's/.00//'`
   
   if [ $my_ac_adapt == "Yes" ]
   then
   echo "Battery: $bat_percent% ↯"
   else
   echo "Battery: $bat_percent% ⚡"
   fi
I don't have a laptop so I can't verify if the battery percentage is actually working, but the rest seems to function properly...

In Topic: Need help with geektool scripting

07 August 2011 - 09:06 PM

ruger42! Thanks for the fast and great help! :)
I sure didn't expect half of the things were going to be solved that fast! :o

I have some problems with the Gmail command you gave me,
I can't get it to work, it gives nothing back.
If I go to https://username:password@mail.google.com/mail/feed/atom/ in my browser, I see the RSS with 2 new emails, so I know I got the username and password right... :(

Don't know what to tell you, the Gmail code works perfectly for me as a single command or as part of the shell script:
unreadCount=`curl --silent https://username:password@mail.google.com/mail/feed/atom/ | awk '/<fullcount>/{print}' | grep -o "[0-9]\+"`
   echo "You have $unreadCount unread emails at Gmail"
Now gives me this:
Attached File  GeektoolHarmcl2.jpg   98.27KB   7 downloads

EDIT:
Make sure you're not using your full email address as the username, I seem to recall reading that if you use the @ symbol in the username field the script will not work...

In Topic: Need help with geektool scripting

07 August 2011 - 05:08 PM

Try this for the weather:
weather=`curl --silent "http://xml.weather.yahoo.com/forecastrss?p=FRXX4403&u=f" | grep -E '(Current Conditions:|F<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/ F<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'`
   
   weather2=`curl --silent "http://xml.weather.yahoo.com/forecastrss?p=FRXX4403&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//'`
	  
   conditions=`echo ${weather2,,}  | cut -f 1 -d ","`
	  
   tempC=`echo ${weather2} | cut -f 2 -d "," | sed -e 's/^[ \t]*//' | cut -c1-2`
	  
   if [ "$weather2" != "" ]
   then
   echo "It's $tempC degrees outside and the weather is $conditions."
   fi
All combined it should look like this:
Attached File  GeekToolHarmclShell.jpg   127.6KB   8 downloads


This will get you the count of unread emails at Gmail (not my creation, found it on the web):
curl --silent https://username:password@mail.google.com/mail/feed/atom/ | awk '/<fullcount>/{print}' | grep -o "[0-9]\+"
I can't find any way to retrieve data from Hotmail...
© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy