I'm new to using geektool and I can get the time to come up but when I try to get the date as well, it deletes the time and vice versa. I can't seem to get more than one geektool to display at one time, they just disappear. Any help? Thanks !![]()
Here's my geektool setup at work...
Hope you like it ;-)
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USOH0110&u=f" | grep -E '(Current Conditions:|[A-Z]<BR)' | sed -e 's/Current Conditions://' -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/[A-Z a-z]*, //' -e 's/\(.*\) F/\1 °F/' -e 's/\(.*\) C/\1 °C/' | sed 's/ //' | tail -n1
Here's my geektool setup at work...
Hope you like it ;-)
Just started working on mine, but after seeing that one above, I'm gonna have to change it around a little
How'd you do the battery and uptime like that, whats the codes and how do you change half the code to one colour?
echo Battery
#!/bin/sh
bat=$((`ioreg -rc "AppleSmartBattery" | awk '/CurrentCapacity/{print $3}'` * 100 / `ioreg -rc "AppleSmartBattery" | awk '/MaxCapacity/{print $3}'`))
echo $bat"%"
echo uptime
osascript /Users/me/Documents/geektool/Uptime.scpt
tell application "Finder"
set upt to do shell script "uptime"
set AppleScript's text item delimiters to ","
set upt to text item 1 of (upt as string)
set AppleScript's text item delimiters to " "
set upt to last text item of (upt as string)
set AppleScript's text item delimiters to ""
return (upt as string)
end tell
If you feel like sharing these codes on other websites, forums,... please ask/inform me and put my credentials with it. If you don't then I won't be sharing any applescript or other in the future. thx ;-)
What? Seems kinda arrogant to me. You really think other people can't duplicate exactly what you did without any particular trouble? You're demanding credit for fairly basic operations that anyone with some basic knowledge should be able to do without consulting you at all.
I dunno, it just doesn't seem like you have any right to demand that.
jW
Yeah, ok. Maybe I didn't have to put that overthere.
But I and I'm not the only one here is putting time and effort in doing this.
And why we do that, because we are proud and want to help others who are not that familiar with scripting.
And if you find it arrogant, then you are talking to every single person inhere who ever posted a script or something inhere.
By the way, if somebody duplicates a complete script with all the info needed to another website then it's always fine that the person says it's not his.
Thats being fair against others
Thats the main reason why I wrote it overthere. I hope you'll understand why I posted it.
And hope there are not more people who thinks this is negative because it's not... i'll keep posting new scripts and stuff
Kind regards,
I use 2 geeklets for each to get it done...
For the battery;
1. drag'n'drop new geeklet and type following in the command lineCode:echo Battery
2. drag'n'drop new shell geeklet ans paste this in the command lineCode:#!/bin/sh bat=$((`ioreg -rc "AppleSmartBattery" | awk '/CurrentCapacity/{print $3}'` * 100 / `ioreg -rc "AppleSmartBattery" | awk '/MaxCapacity/{print $3}'`)) echo $bat"%"
Uptime
I'm still learning shell script, sometime soon there will be a shell version of the uptime which is better at performance i think ;-)
1. drag'n'drop new geeklet and type following in the command lineCode:echo uptime
2.drag'n'drop new shell geeklet ans paste this in the command line
Path to the script (don't forget to change the path)Code:osascript /Users/me/Documents/geektool/Uptime.scpt
Applescript code | Uptime
copy, past and save as an applescript
Code:tell application "Finder" set upt to do shell script "uptime" set AppleScript's text item delimiters to "," set upt to text item 1 of (upt as string) set AppleScript's text item delimiters to " " set upt to last text item of (upt as string) set AppleScript's text item delimiters to "" return (upt as string) end tell
If you feel like sharing these codes on other websites, forums,... please ask/inform me and put my credentials with it. If you don't then I won't be sharing any applescript or other in the future. thx ;-)
And if you find it arrogant, then you are talking to every single person inhere who ever posted a script or something inhere.
Well thank you for the code, heres how it came out.
http://i151.photobucket.com/albums/s130/stessler30/Screenshot2010-03-11at70238AM.png
tell application "Finder"
set upt to do shell script "uptime" as string
if upt contains "mins" then
set one to "mins"
set two to "up "
set type to "min"
my uptime(one, two, type, upt)
else if upt contains "hr" then
set one to "hr"
set two to "up "
set type to "hour"
my uptime(one, two, type, upt)
else
set one to ","
set two to "up "
set type to ""
my uptime(one, two, type, upt)
end if
end tell
on uptime(one, two, type, upt)
tell application "Finder"
set AppleScript's text item delimiters to one
set upt to text item 1 of upt
set AppleScript's text item delimiters to two
return (text item 2 of upt) & type
end tell
end uptime
Wow thank you, looks amazing!Your welcome,
Here is the update for the uptime code.
This should work now ;-) with minutes, hours and normal
Code:tell application "Finder" set upt to do shell script "uptime" as string if upt contains "mins" then set one to "mins" set two to "up " set type to "min" my uptime(one, two, type, upt) else if upt contains "hr" then set one to "hr" set two to "up " set type to "hour" my uptime(one, two, type, upt) else set one to "," set two to "up " set type to "" my uptime(one, two, type, upt) end if end tell on uptime(one, two, type, upt) tell application "Finder" set AppleScript's text item delimiters to one set upt to text item 1 of upt set AppleScript's text item delimiters to two return (text item 2 of upt) & type end tell end uptime
I certainly appreciate everyone who posts and shares code here, because I don't understand any of it, but I can sure copy/paste with the best of them
I don't take anyone's time and effort for granted here
And I always come back to say thank you to the one who helped me
But to me, helping someone and sharing is always the reward in itself
If you need a pat on the back every time a snip of code is used, then make a commercial app and sell it, then the $$ can be your reward
Wow thank you, looks amazing!
tell application "Finder"
set upt to do shell script "uptime" as string
if upt contains "mins" then
set one to "mins"
set two to "up "
set type to "min"
my uptime(one, two, type, upt)
else if upt contains "hr" then
set one to "hr"
set two to "up "
set type to "hour"
my uptime(one, two, type, upt)
else
set one to ","
set two to "up "
set type to ""
my uptime(one, two, type, upt)
end if
end tell
on uptime(one, two, type, upt)
tell application "Finder"
set AppleScript's text item delimiters to one
set upt to text item 1 of upt
set AppleScript's text item delimiters to two
return (text item 2 of upt) & type
end tell
end uptime
I've spotted a problem when you leave your mac on. its fixed now ;-)
So when your uptime is going over 10 hours
copy and paste
Code:tell application "Finder" set upt to do shell script "uptime" as string if upt contains "mins" then set one to "mins" set two to "up " set type to "min" my uptime(one, two, type, upt) else if upt contains "hr" then set one to "hr" set two to "up " set type to "hour" my uptime(one, two, type, upt) else set one to "," set two to "up " set type to "" my uptime(one, two, type, upt) end if end tell on uptime(one, two, type, upt) tell application "Finder" set AppleScript's text item delimiters to one set upt to text item 1 of upt set AppleScript's text item delimiters to two return (text item 2 of upt) & type end tell end uptime
TZ=America/GMT+8 date +"Sacramento: %l:%M %p on %d %B"
I feel terrible asking because I wish I could write these myself but when it went over 1 day uptime it was fine until it got to 1 day and 1 hour it just reads 1 day. Is it any easy fix to get to to so x Day, x Hour, x Min?
EDIT* It will read 1 Day 1 Hour, 1 Day 2 Hour ext ext but anything like x Day x Hour x Min it just puts out 1 Day.
tell application "Finder"
set upt to do shell script "uptime" as string
if upt contains "days" then
set one to ","
set two to "up "
set type to ""
my uptime(one, two, type, upt)
else if upt contains "mins" then
set one to "mins"
set two to "up "
set type to "min"
my uptime(one, two, type, upt)
else if upt contains "hr" then
set one to "hr"
set two to "up "
set type to "hour"
my uptime(one, two, type, upt)
else
set one to ","
set two to "up "
set type to ""
my uptime(one, two, type, upt)
end if
end tell
on uptime(one, two, type, upt)
tell application "Finder"
set hrs to ""
set AppleScript's text item delimiters to one
set dys to text item 1 of upt
if upt contains "days" then
set hrs to text item 2 of upt
set dys to dys & ","
end if
set AppleScript's text item delimiters to two
return (text item 2 of dys) & hrs & type
end tell
end uptime