[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 981: getdate(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
Tynsoe Projects • View topic - battery time..

battery time..

battery time..

Postby rudeboy » Fri May 14, 2010 1:17 pm

my code is in another thread (here), the battery time is displaying weird when the battery is 100%, anyway to change that ?

screen shot:
Image


(ps. iPhone /w flipclock is work in progress :}

tks.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Sat May 15, 2010 8:10 pm

The thread you are pointing to rely on a script named battery_time.scpt.
Where can we find it ? The error comes from it.
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Sun May 16, 2010 3:32 am

here's the script (battery_time.scpt)

Code: Select all
tell application "Finder"
   
   set min to do shell script "ioreg -rc \"AppleSmartBattery\" | awk '/TimeRemaining/{print $3}'"
   set h to character 1 of ((min / 60) as string)
   set m to (min - (60 * h)) as string
   if (count of every character of m) = 1 then
      set m to "0" & m
   end if
   return ((h & ":" & m) as string)
   
end tell
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Sun May 16, 2010 7:12 am

Don't know what this script is expecting, but basically :

Code: Select all
ioreg -rc "AppleSmartBattery" | awk '/TimeRemaining/{print $3}'
returns 65535 for a full battery

I don't believe like the script that the actual first character of 65535 is a clue about how many minutes are left. Maybe this script is outdated and rely on values returned by previous system releases
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Mon May 17, 2010 2:39 am

i don't know... found it and used/using it and only "error" in the output number when battery is fully charged... otherwise it outputs what the information in the statusbar..
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Mon May 17, 2010 6:17 am

That's odd, I re-tested the same command today and the result is no longer 65535, but 260, which looks like a minutes value to me.
When this problem happens, check the value of
Code: Select all
ioreg -rn AppleSmartBattery | grep TimeRemaining


Maybe this is a bug on Apple's side
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby ybizeul » Mon May 17, 2010 6:38 am

For the record, the whole script can be replaced by this command line :
Code: Select all
MIN=`ioreg -rn AppleSmartBattery | awk "/TimeRemaining/"'{ print $3 }'`;H=$(( $MIN / 60 ));M=$(( $MIN - ($MIN / 60) * 60 ));printf "%i:%.02i" $H $M
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Re: battery time..

Postby rudeboy » Tue May 18, 2010 2:27 am

ybizeul wrote:For the record, the whole script can be replaced by this command line :
Code: Select all
MIN=`ioreg -rn AppleSmartBattery | awk "/TimeRemaining/"'{ print $3 }'`;H=$(( $MIN / 60 ));M=$(( $MIN - ($MIN / 60) * 60 ));printf "%i:%.02i" $H $M


replaced it, works w/o text but after i tried adding text it doesn't work anymore...

my code:

Code: Select all
uptime | awk '{ print "Uptime : " $3 " " $4 " " $5 " " }'; top -l 1 | awk '/PhysMem/ {print "RAM : " $8 " "}' ; top -l 2 | awk '/CPU usage/ && NR > 5 {print $6, $7=":", $8, $9="user " $10, $11="sys ," $12, $13}' 'who | awk '{ print $1 }'|uniq|sort'
df -h | grep disk0s2 | awk '{print "Mac HD:", $2, "total,", $3, "used,", $4, "remaining"}'
echo Battery: `pmset -g ps  |  sed -n 's/.*[[:blank:]]+*\(.*%\).*/\1/p'` {print - Time:} MIN=`ioreg -rn AppleSmartBattery | awk "/TimeRemaining/"'{ print $3 }'`;H=$(( $MIN / 60 ));M=$(( $MIN - ($MIN / 60) * 60 ));printf "%i:%.02i" $H $M
echo External IP: `curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g'`


thanks.
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: 2 "commands" in one line...?

Postby rudeboy » Tue May 18, 2010 2:36 am

ybizeul wrote:Copy and paste the output of that command, including the command, and its full result, from Terminal application :-)


you're correct (not that i doubted you)... in GeekTool there's no error plus the little badge is green and not red, here's the output:

Image
rudeboy
 
Posts: 18
Joined: Sun May 09, 2010 3:33 pm

Re: battery time..

Postby ybizeul » Tue May 18, 2010 6:31 am

Sorry I don't get your logic here.

Give me a sample of the full output you'd like.
ybizeul
Site Admin
 
Posts: 133
Joined: Fri Jan 22, 2010 4:34 pm

Next

Return to GeekTool

Who is online

Users browsing this forum: No registered users and 2 guests

cron