Wie lange braucht mein Mac zum Aufwachen…

7/05/2011
Ich finde es etwas fragwürdig, das per Skript zu messen... aber wie sonst? Es ist aber ein nettes Beispiel, wie man pmset skripten kann.

--07.05.2011 hubionmac.com

--skript that measures the time until wakeup is complete

-- this gives a f*** about your wakeorpoweron settings, they will be deleted!!!


set mystartup to build_pmset_date(1)

set ct to current date

tell application "Finder" to sleep

repeat until 1 = 0

if ct > mystartup then

exit repeat

else

set ct to current date

delay 1

end if

end repeat

set diff to ct - mystartup

display dialog "Waking up took me " & diff & " sec."

--clean wakup-plan

do shell script "pmset repeat cancel" with administrator privileges



on build_pmset_date(plusminutes)

set d to (current date) + (plusminutes * 60)

--make sure that we will end up with at least 1 minute...

if seconds of d > 30 then

set d to d + 60

end if

set thehour to characters -2 through -1 of (("0" & (hours of d as integer)) as text)

set theminutes to characters -2 through -1 of (("0" & (minutes of d as integer)) as text)

--pmset does not care about seconds...

set theseconds to "00"

set seconds of d to 0

set thetime to thehour & ":" & theminutes & ":" & theseconds

--clean wakup-plan

do shell script "pmset repeat cancel" with administrator privileges

--set the plan

do shell script "pmset repeat wakeorpoweron MTWRFSU \"" & thetime & "\"" with administrator privileges

return d

end build_pmset_date

No Comments

Batterielaufzeit messen

24/08/2010

Wenn man mal wissen möchte, wie lange die Batterie läuft und wie der Ladungsverlauf so aussieht, kann man sich mit pmset -g pslog >> ~/Desktop/pslog.txt ein Log schreiben lassen...


No Comments