<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>codingstube &#187; Scripts</title>
	<atom:link href="http://codingstube.de/tag/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://codingstube.de</link>
	<description>Ein weiterer WordPress-Blog</description>
	<lastBuildDate>Sat, 17 Dec 2011 13:23:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>GeekTool ist klasse!</title>
		<link>http://codingstube.de/2009/04/geektool-ist-klasse/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=geektool-ist-klasse</link>
		<comments>http://codingstube.de/2009/04/geektool-ist-klasse/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 08:19:26 +0000</pubDate>
		<dc:creator>MS</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[geektool]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://codingstube.de/?p=127</guid>
		<description><![CDATA[Do I have to say more? Mal ehrlich was ist bzw. was bewirkt das GeekTool. Ein Bild sagt mehr als tausend Worte: Wie ihr diese schönen Infos anzeigen könnt, werde ich im Weiteren erklären. In dem Screenshot wird das iTunes Album Cover, iTunes Titelinfo, Uptime des Rechners, angemeldete Benutzer, Ramverbrauch, Datum und Uhrzeit in deutsch [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Do I have to say more? <img src='http://codingstube.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: left;">Mal ehrlich was ist bzw. was bewirkt das GeekTool. Ein Bild sagt mehr als tausend Worte:</p>
<p style="text-align: center;"><a class="thickbox" title="Geek Tool" href="http://codingstube.de/wp-content/uploads/2009/04/screen-capture1.png"><img class="aligncenter size-full wp-image-137" src="http://codingstube.de/wp-content/uploads/2009/04/screen-capture1-150x139.png" alt="" width="150" height="139" /></a></p>
<p style="text-align: left;"><br class="clear" /><br />
Wie ihr diese<span style="text-decoration: line-through;"> schönen</span> Infos anzeigen könnt, werde ich im Weiteren erklären.<br />
<br class="clear" /><br />
In dem Screenshot wird das iTunes Album Cover, iTunes Titelinfo, Uptime des Rechners,  angemeldete Benutzer, Ramverbrauch, Datum und Uhrzeit in deutsch angezeigt. Alle Komponenten kann man einzeln aktivieren und es bleibt euch überlassen, was ihr benutzt und was nicht. Jedes Element werde ich im folgenden erklären.<br />
<span id="more-127"></span></p>
<h2 style="text-align: left;"><strong>Anzeige des Datums:</strong></h2>
<p style="text-align: left;"><a class="thickbox" title="datum" rel="same-post-127" href="http://codingstube.de/wp-content/uploads/2009/04/datum.png"><img class="alignleft size-full wp-image-182" title="datum" src="http://codingstube.de/wp-content/uploads/2009/04/datum.png" alt="" width="339" height="71" /></a></p>
<p><br class="clear" /><br />
Diese Infos sind aus 3 Shell Einträgen zusammengesetzt worden. Einfach die folgenden Zeilen als einzelne Einträge ins GeekTool einfügen und nach belieben bearbeiten:<br />
<br class="clear" /></p>
<p><strong>GeekTool Shell Uhrzeit:</strong></p>
<blockquote><p>date &#8216;+%H:%M&#8217;</p></blockquote>
<p><br class="clear" /><br />
<strong>GeekTool Shell Tag:</strong></p>
<blockquote><p>date &#8220;+%A&#8221; | sed -e &#8216;s/Monday/Montag/g&#8217; -e &#8216;s/Tuesday/Dienstag/g&#8217; -e &#8216;s/Wednesday/Mittwoch/g&#8217; -e &#8216;s/Thursday/Donnerstag/g&#8217; -e &#8216;s/Friday/Freitag/g&#8217; -e &#8216;s/Saturday/Samstag/g&#8217; -e &#8216;s/Sunday/Sonntag/g&#8217;<strong><br />
</strong></p></blockquote>
<p><br class="clear" /><br />
<strong>Geektool Shell Datum:</strong></p>
<blockquote><p>date &#8220;+%d %B&#8221; | sed -e &#8216;s/January/Jan/g&#8217; -e &#8216;s/February/Feb/g&#8217; -e &#8216;s/March/Marz/g&#8217; -e &#8216;s/April/April/g&#8217; -e &#8216;s/May/Mai/g&#8217; -e &#8216;s/June/Juni/g&#8217; -e &#8216;s/July/Juli/g&#8217; -e &#8216;s/August/Aug/g&#8217; -e &#8216;s/September/Sep/g&#8217; -e &#8216;s/October/Oct/g&#8217; -e &#8216;s/November/Nov/g&#8217; -e &#8216;s/December/Dez/g&#8217;<strong><br />
</strong></p></blockquote>
<p><br class="clear" /></p>
<h2 style="text-align: left;"><strong><strong>Anzeige des Uptimes und der Verbauch von CPU / RAM:<br />
</strong></strong></h2>
<p><br class="clear" /></p>
<p style="text-align: left;"><a class="thickbox" title="uptime" rel="same-post-127" href="http://codingstube.de/wp-content/uploads/2009/04/uptime.png"><img class="size-full wp-image-170 alignleft" title="uptime" src="http://codingstube.de/wp-content/uploads/2009/04/uptime.png" alt="" width="215" height="50" /></a><br class="clear" /></p>
<p style="text-align: left;">
<p><br class="clear" /></p>
<p style="text-align: left;">Durch den angenehmen Ruhezustand ist es oft möglich, dass euer Mac mal mehrere Tage &#8220;online&#8221; ist und ein Neustart in weiter Ferne. Diese Anzeige zeigt euch wielange das schon der Fall ist <img src='http://codingstube.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Außerdem werden CPU Last und Ram-Verbaucht angezeigt.<br />
<br class="clear" /><br />
<strong>GeekTool Shell Entry</strong></p>
<blockquote style="text-align: left;"><p>uptime | awk &#8216;{print &#8220;UPTIME : &#8221; $3 &#8221; &#8221; $4 &#8221; &#8221; $5 &#8221; &#8221; }&#8217;; top -l 1 | awk &#8216;/PhysMem/ {print &#8220;RAM : &#8221; $8 &#8221; &#8220;}&#8217; ; top -l 2 | awk &#8216;/CPU usage/ &amp;amp;&amp;amp; NR &amp;gt; 5 {print $6, $7=&#8221;:&#8221;, $8, $9=&#8221;user &#8220;, $10, $11=&#8221;sys &#8220;, $12, $13}&#8217;</p></blockquote>
<p><br class="clear" /></p>
<h2><strong>Spielender Track in iTunes &#8211; Track, Artist, Album</strong></h2>
<p><br class="clear" /><br />
Natürlich gibt es auch Programme, die diese Informationen darstellen können. Aber hier hat man einfach mehr Freiheiten. Es wird der Titel mit Status (gestoppt, pausiert, &#8230;), der Interpret und das Album angezeigt.<br />
<br class="clear" /><br />
<a class="thickbox" title="title" rel="same-post-127" href="http://codingstube.de/wp-content/uploads/2009/04/title.png"><img class="size-full wp-image-178 alignleft" title="title" src="http://codingstube.de/wp-content/uploads/2009/04/title.png" alt="" width="423" height="106" /></a><br />
<br class="clear" /><br />
Für diese Anzeige benötigt man zusätzlich ein Script. Dieses Script wird über das GeekTool aufgerufen:<br />
<br class="clear" /><br />
<strong>Geek Tool Shell Entry:</strong></p>
<blockquote><p>osascript /Users/marius/Documents/Scripts/iTunesGeektool.scpt</p></blockquote>
<p><br class="clear" /><br />
<strong>Script:</strong></p>
<blockquote><p>
tell application &#8220;System Events&#8221;<br />
set powerCheck to ((application processes whose (name is equal to &#8220;iTunes&#8221;)) count)<br />
if powerCheck = 0 then<br />
return &#8220;&#8221;<br />
end if<br />
end tell<br />
tell application &#8220;iTunes&#8221;<br />
try<br />
set playerstate to (get player state)<br />
end try<br />
if playerstate = paused then<br />
set trackPaused to &#8221; (paused)&#8221;<br />
else<br />
set trackPaused to &#8220;&#8221;<br />
end if<br />
if playerstate = stopped then<br />
return &#8220;Stopped&#8221;<br />
end if<br />
set trackID to the current track<br />
set trackName to the name of trackID<br />
set artistName to the artist of trackID<br />
set albumName to the album of trackID<br />
set totalData to &#8220;Track  : &#8221; &amp; trackName &amp; trackPaused &amp; &#8221;<br />
Artist : &#8221; &amp; artistName &amp; &#8221;<br />
Album  : &#8221; &amp; albumName<br />
return totalData<br />
end tell</p></blockquote>
<p><br class="clear" /></p>
<h2><strong>AlbumCover anzeigen</strong></h2>
<p><br class="clear" /></p>
<p><strong><a class="thickbox" title="cover" rel="same-post-127" href="http://codingstube.de/wp-content/uploads/2009/04/cover.png"><img class="alignleft size-full wp-image-180" title="cover" src="http://codingstube.de/wp-content/uploads/2009/04/cover.png" alt="" width="303" height="231" /></a><br />
</strong><br />
<br class="clear" /><br />
Um das Cover anzeigen zu lassen, ist ein wenig mehr zu tun, aber nicht wirklich schwierig.<br />
<br class="clear" /><br />
Zum einen benötigen wir wieder ein Script, welches das Geektool aufruft. Dieses erstellt eine Bilddatei aus dem Cover. Ein weiterer GeekTool-Eintrag liest das Bild ein und zeigt es auf eurem Desktop.<br />
<br class="clear" /><br />
<strong>GeekTool Shell Eintrag:</strong></p>
<blockquote><p>osascript /Users/marius/Documents/Scripts/iTunesGeektoolCover.scpt</p></blockquote>
<p><br class="clear" /><br />
<strong>GeekTool Picture Eintrag:</strong></p>
<blockquote><p>file:///Users/marius/Pictures/iTunes%20Artwork/albumArt.tif</p></blockquote>
<p><br class="clear" /><br />
<strong>Script:</strong></p>
<blockquote><p>(* Set Defaults and Loctions *)</p>
<p>set iTunesArtworkFolder to ((path to home folder) as text) &amp; &#8220;Pictures:iTunes Artwork:&#8221;<br />
&#8211; Artwork Folder</p>
<p>set DefaultArtwork to ((path to home folder) as text) &amp; &#8220;Pictures:iTunes Artwork:albumArt.tif&#8221;<br />
&#8211; When there&#8217;s no artwork or iTunes isn&#8217;t running. This is a transparent TIFF.</p>
<p>set DefaultFolder to ((path to home folder) as text) &amp; &#8220;Pictures:iTunes Artwork:&#8221;<br />
&#8211; Default Folder</p>
<p>set FromiTunesFolder to ((path to home folder) as text) &amp; &#8220;Pictures:iTunes Artwork:&#8221;<br />
&#8211; Where iTunes saves the Artwork</p>
<p>set ArtworkFromiTunes to FromiTunesFolder &amp; &#8220;albumArt.pict&#8221; as file specification<br />
&#8211; The Artwork from iTunes</p>
<p>set AlbumArtwork to (path to home folder) &amp; &#8220;Pictures:iTunes Artwork:albumArt.tif&#8221; as string<br />
&#8211; The Album Artwork</p>
<p>set UnixAlbumArtwork to the quoted form of POSIX path of AlbumArtwork<br />
&#8211; Unix path to the Album Artwork</p>
<p>(* Check if iTunes is running. *)</p>
<p>tell application &#8220;System Events&#8221;<br />
if exists process &#8220;iTunes&#8221; then<br />
try</p>
<p>(* Get Artwork From iTunes *)<br />
tell application &#8220;iTunes&#8221;<br />
set aLibrary to name of current playlist &#8212; Name of Current Playlist<br />
set aTrack to current track<br />
set aTrackArtwork to null</p>
<p>(* Is there any Artwork? *)<br />
if (count of artwork of aTrack) ? 1 then<br />
set aTrackArtwork to data of artwork 1 of aTrack<br />
set fileRef to (open for access ArtworkFromiTunes with write permission)<br />
try<br />
set eof fileRef to 512<br />
write aTrackArtwork to fileRef starting at 513<br />
close access fileRef<br />
on error errorMsg<br />
try<br />
close access fileRef<br />
end try<br />
error errorMsg<br />
end try</p>
<p>(* Convert to Tiff *)<br />
tell application &#8220;Finder&#8221; to set creator type of ArtworkFromiTunes to &#8220;????&#8221;</p>
<p>tell application &#8220;Image Events&#8221;<br />
set theImage to open ArtworkFromiTunes<br />
save theImage as TIFF in iTunesArtworkFolder &amp; &#8220;albumArt.tif&#8221; with replacing<br />
end tell</p>
<p>else</p>
<p>(* If there&#8217;s no Artwork use the Blank Arwork. *)<br />
tell application &#8220;iTunes&#8221;<br />
if (count of artwork of aTrack) &lt; 1 then<br />
set aTrackArtwork to DefaultArtwork</p>
<p>set unixDefaultFolder to the quoted form of POSIX path of DefaultFolder<br />
set unixiTunesArtworkFolder to the quoted form of POSIX path of iTunesArtworkFolder</p>
<p>do shell script &#8220;ditto -rsrc &#8221; &amp; unixDefaultFolder &amp; space &amp; unixiTunesArtworkFolder</p>
<p>end if<br />
end tell<br />
end if<br />
end tell<br />
end try</p>
<p>else<br />
if (exists process &#8220;iTunes&#8221;) is false then</p>
<p>(* If itunes isn&#8217;t running use the Blank Artwork *)<br />
tell application &#8220;Finder&#8221;<br />
set unixDefaultFolder to the quoted form of POSIX path of DefaultFolder<br />
set unixiTunesArtworkFolder to the quoted form of POSIX path of iTunesArtworkFolder</p>
<p>do shell script &#8220;ditto -rsrc &#8221; &amp; unixDefaultFolder &amp; space &amp; unixiTunesArtworkFolder<br />
end tell</p>
<p>end if<br />
end if<br />
end tell</p></blockquote>
<p><br class="clear" /></p>
]]></content:encoded>
			<wfw:commentRss>http://codingstube.de/2009/04/geektool-ist-klasse/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

