Go Back   MacRumors Forums > Mac Community > Picture Gallery > UI Customization

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 8, 2012, 07:50 PM   #1
brenm666
macrumors regular
 
Join Date: May 2010
Location: Montréal, QC
Your Geektool scripts (II)

Here's the continuation of the first Geektool thread.
brenm666 is offline   0 Reply With Quote
Old Nov 9, 2012, 07:09 AM   #2
maflynn
Moderator
 
maflynn's Avatar
 
Join Date: May 2009
Location: Boston
I would like to point out unlike the prior thread, there is no longer a need to put all your geektool questions, issues, and scripts in a single thread. Now with the UI Customization forum, members are free to create new geektool threads as they deem necessary
maflynn is offline   0 Reply With Quote
Old Nov 11, 2012, 02:07 PM   #3
willfurnell
macrumors member
 
Join Date: Feb 2011
Well, I'll start the thread off with a couple of useful scripts I have found, I think they may have originally come from here.

The first is to check if a service is online:
Code:
#######Server Checker#########
HOST=DNS.NAME.GOES.HERE
PING=`ping -q -c 1 $HOST`
if [[ $? -eq 0 ]] ; then
    TIME=`echo $PING |tail -1 | cut -d/ -f 5`
    echo $HOST is Online
else
    echo $HOST is Offline
fi
And the second is for External/Internal IP addresses. I'm not sure whether Lynx is installed by default (probably not) - so you will need it if you wish to use the External IP code. The Internal IP code omits IPv6 Addresses and a couple of VMware interfaces. This can easily be removed by removing the -v from grep.
Code:
########EXTERNAL IP###########
echo ""
NET1=`lynx -dump http://checkip.dyndns.org | cut -d : -f 2`
echo External: $NET1 
########INTERNAL IP###########
echo ""
NET2=`ifconfig | grep "inet" | grep -v 127.0.0.1 | grep -v inet6 |grep -v 192.168.48.1 | grep -v 192.168.183.1 | awk '{print $2}'`
echo Internal: $NET2
willfurnell is offline   0 Reply With Quote
Old Nov 26, 2012, 10:55 AM   #4
Mal
macrumors 603
 
Mal's Avatar
 
Join Date: Jan 2002
Location: Orlando
I would appreciate some help here. I've been using this horizontal calendar script, which I love, but it somehow is automatically coloring the current date in red, but I'd like to change that to a different color. Any help?

Code:
echo `cal`" " |
sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/\1/')\1/" |
sed s'/ $//' |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \ •  /g' |
sed s'/\([a-z]\)[ ]\ ./\1/g' |
sed s'/\•[ ]*\•/ /'|
sed s"/$/     $(date +%A)/"
jW
__________________
The Bearded Nerd
13" MacBook Pro; 64GB iPod touch
"It's a real burn, being right so often."
NoiseTrade.com/Walker
Mal is offline   0 Reply With Quote
Old Nov 28, 2012, 06:23 PM   #5
rhett7660
macrumors G3
 
rhett7660's Avatar
 
Join Date: Jan 2008
Location: Sunny, Southern California
Quote:
Originally Posted by Mal View Post
I would appreciate some help here. I've been using this horizontal calendar script, which I love, but it somehow is automatically coloring the current date in red, but I'd like to change that to a different color. Any help?

Code:
echo `cal`" " |
sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/\1/')\1/" |
sed s'/ $//' |
sed s'/Su Mo Tu We Th Fr Sa//g' |
sed s'/ / \ •  /g' |
sed s'/\([a-z]\)[ ]\ ./\1/g' |
sed s'/\•[ ]*\•/ /'|
sed s"/$/     $(date +%A)/"
jW
there is nothing else this is using to color the date?
__________________
"It's quite an experience to hold the hand of someone as they move from living to dead."
"Times are looking grim these days, holding on to everything, it's hard to draw the line"
rhett7660 is offline   0 Reply With Quote
Old Nov 28, 2012, 11:34 PM   #6
Mal
macrumors 603
 
Mal's Avatar
 
Join Date: Jan 2002
Location: Orlando
Quote:
Originally Posted by rhett7660 View Post
there is nothing else this is using to color the date?
Nothing that I can see. The Font color in GeekTool affects only the rest of the days, but there's not a separate script for the colored day and nothing I can identify that would change that color.

This is what the window looks like (with the entire script being what I copy/pasted before):


jW
__________________
The Bearded Nerd
13" MacBook Pro; 64GB iPod touch
"It's a real burn, being right so often."
NoiseTrade.com/Walker
Mal is offline   0 Reply With Quote
Old Nov 29, 2012, 09:46 AM   #7
rhett7660
macrumors G3
 
rhett7660's Avatar
 
Join Date: Jan 2008
Location: Sunny, Southern California
Quote:
Originally Posted by Mal View Post
Nothing that I can see. The Font color in GeekTool affects only the rest of the days, but there's not a separate script for the colored day and nothing I can identify that would change that color.

This is what the window looks like (with the entire script being what I copy/pasted before):
Image

jW
Hmmm.. Granted I am pretty new at this, so I am going to have to defer this one. Sorry I couldn't help. For some reason I thought there was another reference that was color coding items. Let me look around a little more. I know I have mine setup to only bold the number no color. So let me take another look.
__________________
"It's quite an experience to hold the hand of someone as they move from living to dead."
"Times are looking grim these days, holding on to everything, it's hard to draw the line"
rhett7660 is offline   0 Reply With Quote
Old Dec 3, 2012, 05:41 AM   #8
dzurn
macrumors newbie
 
Join Date: Apr 2004
Location: 3rd Rock from the Sun, Western Wisconsin USA
Quote:
Originally Posted by Mal View Post
Nothing that I can see. The Font color in GeekTool affects only the rest of the days, but there's not a separate script for the colored day and nothing I can identify that would change that color.

This is what the window looks like (with the entire script being what I copy/pasted before):
Image

jW
You likely have another Geeklet which is almost identical to this one, and even starts out with echo `cal`" " except that this other geeklet is changed to ONLY show today's date in it, and that one is colored red.

You can check by first giving the Geeklet you can see a name (besides the random string) and then moving it up or down by 100. Then you'll see the other Geeklet left behind. You can then rename that one, change its color, and move the other one back into place.

It's the "date +%e" inside one of the sed statements that shows today's date is being replaced with a space.

Darryl
dzurn is offline   0 Reply With Quote
Old Dec 3, 2012, 08:26 AM   #9
TriBull
macrumors newbie
 
Join Date: Dec 2012
The color is defined in the second line of your script

sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/\1/')\1/" |


Just change the number 31 to change the color as follows:

30 - black
31 - red
32 - green
33 - yellow
34 - blue
35 - magenta
36 - cyan
37 - white
TriBull is offline   0 Reply With Quote
Old Dec 3, 2012, 09:09 AM   #10
Mal
macrumors 603
 
Mal's Avatar
 
Join Date: Jan 2002
Location: Orlando
Quote:
Originally Posted by TriBull View Post
The color is defined in the second line of your script

sed "s/[^0-9]$(date +%e | sed s'/ //')\([^0-9]\)/ $(date +%e | sed 's/ *\([0-9]*\)/\1/')\1/" |


Just change the number 31 to change the color as follows:

30 - black
31 - red
32 - green
33 - yellow
34 - blue
35 - magenta
36 - cyan
37 - white
Perfect! Thanks, I knew it was in there because there wasn't a second shell.

jW
__________________
The Bearded Nerd
13" MacBook Pro; 64GB iPod touch
"It's a real burn, being right so often."
NoiseTrade.com/Walker
Mal is offline   0 Reply With Quote
Old Dec 5, 2012, 10:55 AM   #11
Neovo417
macrumors newbie
 
Join Date: Mar 2008
I modified this script from itunes to use Spotify form the process list everything works but the Player position I receive from Spotify is very accurate and Returns 12 Decimal places

Code:
get player position
		--> 294.496002197266
Can someone help me round this so the Result has no Decimal Places?

Thanks

The Script
Code:
tell application "System Events"
	set myList to (name of every process)
end tell

if myList contains "Spotify" then
	tell application "Spotify"
		try
			set trackname to name of current track
			set artistname to artist of current track
			set albumname to album of current track
			
			set timetofinish to player position
			set hourstofinish to timetofinish div 3600
			set secondstofinish to timetofinish mod 3600
			set minutostofinish to secondstofinish div 60
			set secondstofinish to secondstofinish mod 60
			
			
			if hourstofinish < 10 then set hourstofinish to "0" & hourstofinish
			if minutostofinish < 10 then set minutostofinish to "0" & minutostofinish
			if secondstofinish < 10 then set secondstofinish to "0" & secondstofinish
			
			if hourstofinish = "00" then
				set timetofinish to (minutostofinish as text) & ":" & secondstofinish
			else
				set timetofinish to (hourstofinish as text) & ":" & minutostofinish & ":" & secondstofinish
			end if
			
			if player state is paused then
				set output to artistname & trackname & return & albumname & return & "" & timetofinish
			else
				set output to artistname & " - " & trackname & return & albumname & return & timetofinish
			end if
			
		on error
			set timetofinish to "No song playing"
		end try
		
	end tell
	
else
	set output to "Offline"
	
end if
The Result
Code:
tell application "System Events"
	get name of every process
		--> {"loginwindow", "SystemUIServer", "Dock", "Finder", "ProFire Agent", "AirPort Base Station Agent", "DiskLed", "iTunesHelper", "Cinch", "smcFanControl", "Battery Health", "Twitter", "GeekTool Helper", "Yahoo! Widgets", "System Events", "Yahoo! Widgets", "AppleSpell", "mdworker", "GeekTool", "Image Events", "Spotify", "quicklookd", "Google Chrome", "Google Chrome Helper", "Google Chrome Helper", "Google Chrome Helper", "Mail", "AppleScript Editor", "osascript"}
end tell
tell application "Spotify"
	get name of current track
		--> "Stream Of Consciousness"
	get artist of current track
		--> "Dream Theater"
	get album of current track
		--> "Train of Thought"
	get player position
		--> 294.496002197266
	get player state
		--> playing
end tell
Result:
"Dream Theater - Stream Of Consciousness
Train of Thought
04:54.496002197266"
Neovo417 is offline   0 Reply With Quote


Reply
MacRumors Forums > Mac Community > Picture Gallery > UI Customization

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Geektool: Help with GeekTool? codyd51 UI Customization 0 Dec 6, 2013 07:01 PM
Need Help with GeekTool on Mavericks Kschulze12 OS X Mavericks (10.9) 1 Nov 3, 2013 08:55 PM
Geektool bodhi9 Mac Applications and Mac App Store 3 Apr 1, 2013 12:30 AM
GeekTool Tander Mac Applications and Mac App Store 2 Dec 4, 2012 10:05 AM
Geektool on rMBP LeGacY X MacBook Pro 6 Jun 30, 2012 11:07 PM

Forum Jump

All times are GMT -5. The time now is 03:54 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC