<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Erik's Lab</title>
	
	<link>http://erikslab.com</link>
	<description>Things I'm working on, not necessarily functioning yet.</description>
	<lastBuildDate>Thu, 12 Jan 2012 14:20:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/EriksLab" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="erikslab" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to deal with Spaces in Filenames?</title>
		<link>http://erikslab.com/2012/01/12/how-to-deal-with-spaces-in-filenames/</link>
		<comments>http://erikslab.com/2012/01/12/how-to-deal-with-spaces-in-filenames/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 14:16:36 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[AppleScript]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=102</guid>
		<description><![CDATA[As an AppleScripter, you always have to deal with the creativity of your users regarding filenames. A simple fact of life. AppleScript is handing you the tools on a silver platter. So, let&#8217;s deal with it. Why is a Space character a problem? A short detour is in order, I presume. The Mac (and the [...]]]></description>
			<content:encoded><![CDATA[<p>As an AppleScripter, you always have to deal with the creativity of your users regarding filenames. A simple fact of life. <em>AppleScript</em> is handing you the tools on a silver platter. So, let&#8217;s deal with it.</p>
<p><span id="more-102"></span></p>
<h3 id="whyisaspacecharacteraproblem">Why is a Space character a problem?</h3>
<p>A short detour is in order, I presume. The <em>Mac</em> (and the <em>iPhone/iPad</em>) encourage you to name things naturally, so instead of <code>MYGRIDEA.TXT</code> <em>Mac users</em> tend to use <code>My great ideas.txt</code> as filename, the same holds true for directory names. <em>OS X</em> is able to deal with spaces in filenames or paths without problems, the UNIX-underpinnings not so much. This means, should you try to feed the latter filename to a shell command, interesting things will happen.</p>
<p>Open AppleScript Editor and type the following line</p>
<pre><code>set myFileName to "My great ideas.txt"
</code></pre>
<p>and click &#8220;Run&#8221; to see the result in the lower pane of the editor window. I should look like this: <code>"My great ideas.txt"</code>.</p>
<p>Now if you want to hand this filename over to a command like <code>print</code>, <code>grep</code>, etc. then these programs will see not one single argument but three arguments:</p>
<ol>
<li><code>My</code></li>
<li><code>great</code></li>
<li><code>ideas.txt</code></li>
</ol>
<p>because the space character is used as a so called <em>delimiter</em>, thus separating (or splitting) your filename into three arguments to the program.</p>
<h3 id="howdoesapplescripthelpsmedealingwithspaces">How does AppleScript helps me dealing with Spaces?</h3>
<p>Good question, simple answer: Just tell <em>AppleScript</em> to do so. The magic happens by using <code>quoted form of</code>. For example</p>
<pre><code>set myFileName to quoted form of "My great ideas.txt"
</code></pre>
<p>gives you the following result: <code>"'My great ideas.txt'"</code>. The key here is the <em>quoting</em> done by <code>'</code>, these single quotes will be handed over to the program as part of the argument, thus telling the program to leave the spaces inside the quotes alone.</p>
<p>I told you, you just have to ask. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=xO7iPhV4PWM:Ae4m1Ni_Xro:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=xO7iPhV4PWM:Ae4m1Ni_Xro:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=xO7iPhV4PWM:Ae4m1Ni_Xro:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=xO7iPhV4PWM:Ae4m1Ni_Xro:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=xO7iPhV4PWM:Ae4m1Ni_Xro:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=xO7iPhV4PWM:Ae4m1Ni_Xro:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=xO7iPhV4PWM:Ae4m1Ni_Xro:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=xO7iPhV4PWM:Ae4m1Ni_Xro:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/xO7iPhV4PWM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2012/01/12/how-to-deal-with-spaces-in-filenames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ringtones by NASA</title>
		<link>http://erikslab.com/2011/09/26/ringtones-by-nasa/</link>
		<comments>http://erikslab.com/2011/09/26/ringtones-by-nasa/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 07:11:23 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[wow]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=98</guid>
		<description><![CDATA[I had my Whiskey-Tango-Foxtrott-Moment™ today when I found this on NASA&#8217;s Website: Download NASA Sounds. The linked website contains directions how to use the provided sound bites as ringtones. Always wanted a geeky sounding ringtone? Here you go. Now I have to figure out which one to use.]]></description>
			<content:encoded><![CDATA[<p>I had my Whiskey-Tango-Foxtrott-Moment™ today when I found this on <em>NASA&#8217;s</em> Website: <a href="http://www.nasa.gov/connect/sounds/" alt="Download ringtones from Nasa" title="Ringtones by NASA">Download NASA Sounds</a>. The linked website contains directions how to use the provided sound bites as <em>ringtones</em>. Always wanted a geeky sounding ringtone? Here you go.</p>
<p>Now I have to figure out which one to use. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=KKO9hZGjRQo:xfdMBxg_5dI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=KKO9hZGjRQo:xfdMBxg_5dI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=KKO9hZGjRQo:xfdMBxg_5dI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=KKO9hZGjRQo:xfdMBxg_5dI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=KKO9hZGjRQo:xfdMBxg_5dI:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=KKO9hZGjRQo:xfdMBxg_5dI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=KKO9hZGjRQo:xfdMBxg_5dI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=KKO9hZGjRQo:xfdMBxg_5dI:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/KKO9hZGjRQo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2011/09/26/ringtones-by-nasa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download additional content for FCPX and Motion 5</title>
		<link>http://erikslab.com/2011/06/21/download-additional-content-for-fcpx-and-motion-5/</link>
		<comments>http://erikslab.com/2011/06/21/download-additional-content-for-fcpx-and-motion-5/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 15:57:37 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=94</guid>
		<description><![CDATA[The new Final Cut Pro X is available in the App Store as of now. Some of the complaints I read in the usual channels circled around the fact that the supplied templates for Final Cut Pro X and Motion 5 seem to be smaller in weight as usual. Do not despair young padwan, help [...]]]></description>
			<content:encoded><![CDATA[<p>The new <a href="http://www.apple.com/finalcutpro/">Final Cut Pro X</a> is available in the <em>App Store</em> as of now. Some of the complaints I read in the usual channels circled around the fact that the supplied templates for <em>Final Cut Pro X</em> and <em>Motion 5</em> seem to be smaller in weight as usual. Do not despair young padwan, help is on the way. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>If you follow <a href="http://support.apple.com/kb/DL1394">this link</a>, then you will find, and I quote: &#8220;Over 1300 sound effects&#8221; and &#8220;Additional presets for the Space Designer plug-in&#8221;, courtesy of Apple (about 640 MB to download).</p>
<p>If you are more of the <em>Motion</em>-type, then following <a href="http://support.apple.com/kb/DL1395">this link</a> allows you to access about 1.15 GB of Motion-goodness like Templates, Graphics, and sample media.</p>
<p>May the bandwith-cap-defying™ deity of your choice be with you. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=sTQxFrJru3o:nz5H4DVykzs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=sTQxFrJru3o:nz5H4DVykzs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=sTQxFrJru3o:nz5H4DVykzs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=sTQxFrJru3o:nz5H4DVykzs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=sTQxFrJru3o:nz5H4DVykzs:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=sTQxFrJru3o:nz5H4DVykzs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=sTQxFrJru3o:nz5H4DVykzs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=sTQxFrJru3o:nz5H4DVykzs:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/sTQxFrJru3o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2011/06/21/download-additional-content-for-fcpx-and-motion-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defining an asymmetric bleed in InDesign CS5.5 using AppleScript</title>
		<link>http://erikslab.com/2011/06/02/defining-an-asymmetric-bleed-in-indesign-cs5-5-using-applescript/</link>
		<comments>http://erikslab.com/2011/06/02/defining-an-asymmetric-bleed-in-indesign-cs5-5-using-applescript/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 10:18:21 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=87</guid>
		<description><![CDATA[Using AppleScript to efficiently create your documents in Adobe InDesign is a no-brainer for most of us. One could create template files to achieve the same result, but, should the need to change said templates arise, then it&#8217;s dialog hell. If you, dear reader, memorized the location of every possible document setting in the program [...]]]></description>
			<content:encoded><![CDATA[<p>Using <em>AppleScript</em> to efficiently create your documents in <em>Adobe InDesign</em> is a no-brainer for most of us. One could create template files to achieve the same result, but, should the need to change said templates arise, then it&#8217;s dialog hell. If you, dear reader, memorized the location of every possible document setting in the program by heart, then this post is not for you. I prefer to be able to see all settings by looking at a text, I therefore use <em>AppleScripts</em> to create the documents I&#8217;m working on. I already told you, I want to concentrate on the creative side of my work.</p>
<p><span id="more-87"></span></p>
<p>I needed to create a document with an asymmetric bleed (nope, I won&#8217;t discuss if that makes sense). Doing so in <em>InDesign</em> is quite simple. Just <code>tell</code> the <code>document preferences</code> what you need:</p>
<pre><code>
set document bleed bottom offset to "3mm"
set document bleed top offset to "3mm"
set document bleed inside or left offset to "0mm"
set document bleed outside or right offset to "3mm"
</code></pre>
<p>When the document showed though, the <em>bleed</em> was the same for all four sides of the page. I checked the code, there should be no bleed on the left, but the program stubbornly refused to do what it was told. I then checked the dialog to set the bleed and lo and behold, setting the bleed manually didn&#8217;t work either. There is a default setting to make the bleed uniform, no matter what.</p>
<p>The innocent (and active) chain-symbol next to the values gave me a clue: <em>InDesign</em> does not switch to non-uniform just because I told it so, it needs more convincing. Some rummaging in the <em>dictionary</em> using <em>AppleScript Editor</em> later and I found a <em>property</em> called <code>document bleed uniform size</code>. I added the following line before setting the bleed:</p>
<pre><code>
set document bleed uniform size to false
</code></pre>
<p>And I got what I wanted. The working block of code needs to be in that order:</p>
<pre><code>
set document bleed uniform size to false
set document bleed bottom offset to "3mm"
set document bleed top offset to "3mm"
set document bleed inside or left offset to "0mm"
set document bleed outside or right offset to "3mm"
</code></pre>
<p>Lesson learned: Always be concise when telling <em>InDesign</em> what you expect.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=wJfgRxJmlzQ:mcvFGFbB2Gg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=wJfgRxJmlzQ:mcvFGFbB2Gg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=wJfgRxJmlzQ:mcvFGFbB2Gg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=wJfgRxJmlzQ:mcvFGFbB2Gg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=wJfgRxJmlzQ:mcvFGFbB2Gg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=wJfgRxJmlzQ:mcvFGFbB2Gg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=wJfgRxJmlzQ:mcvFGFbB2Gg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=wJfgRxJmlzQ:mcvFGFbB2Gg:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/wJfgRxJmlzQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2011/06/02/defining-an-asymmetric-bleed-in-indesign-cs5-5-using-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging with launchd</title>
		<link>http://erikslab.com/2011/02/04/logging-with-launchd/</link>
		<comments>http://erikslab.com/2011/02/04/logging-with-launchd/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 11:04:35 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=75</guid>
		<description><![CDATA[Apple switched from cron to launchd a while ago, but the fact that launchd allows you to log the output of your program or script quite easily seems to be shrouded in mystery for no apparent reason. Do you know how to create/write logfiles using launchd-plists? If not, read on. Every program/script should write its [...]]]></description>
			<content:encoded><![CDATA[<p><em>Apple</em> switched from <code>cron</code> to <code>launchd</code> a while ago, but the fact that <code>launchd</code> allows you to log the output of your program or script quite easily seems to be shrouded in mystery for no apparent reason. Do you know how to create/write logfiles using <code>launchd</code>-plists? If not, read on.</p>
<p><span id="more-75"></span></p>
<p>Every program/script should write its messages to a logfile, period. It just makes sense to be able to figure out what happened or went wrong after the fact. So far, so obvious. A program or script usually takes advantage of, either some kind of framework to write the logs, or relays the work — by using <code>STDOUT</code> and <code>STDERR</code> — to the executing shell. (I know I&#8217;m simplifying here, but bear with me.) Let&#8217;s assume, that we are using a <em>bash</em>-script, controlled by <code>launchd</code>, to do some work and relay the logging to the shell. Meaning we use <code>echo</code> inside the script to write out diagnostic messages like so:</p>
<p><code>echo &quot;`date +&quot;%b %d %Y %H:%M&quot;` $0: Everything is peachy.&quot;</code></p>
<p>We write the date and time, the name of the program, and the message we want to convey. When run on the command-line, the message shows up in the terminal. When run via <code>launchd</code> there is no <code>STDOUT</code> to write to; the string probably ends up in the <code>system.log</code> and we have to search for it. Enter the magic of <code>launchd</code>.</p>
<p>The <em>PropertyList-1.0.dtd</em> for <code>launchd</code> luckily contains two keys to make our life easier, the first one is called <em>StandardOutPath</em> and is used inside a <em>launchd-plist</em> like so:</p>
<p><code>&lt;key&gt;StandardOutPath&lt;/key&gt;<br />
&lt;string&gt;/var/log/progname.log&lt;/string&gt;</code></p>
<p><code>launchd</code> interprets this key and string as &#8220;if there is something written to STDOUT, then write it to the file pointed to by the string.&#8221; In the example above to the file <code>/var/log/progname.log</code>. Great, but what about the errors? Glad you asked.</p>
<p>The second key is called <em>StandardErrorPath</em> and will process everything written to <code>STDERR</code>.</p>
<p><code>&lt;key&gt;StandardErrorPath&lt;/key&gt;<br />
&lt;string&gt;/var/log/progname_err.log&lt;/string&gt;</code></p>
<p>You could use the same file for both by using the same filename, should you be inclined to do so. I prefer to separate the messages.</p>
<p>Happy logging everyone.</p>
<p>Don&#8217;t you hate it when posts like this do not contain a full example? <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I do. So here it goes:</p>
<p>The <em>bash</em>-script (named <code>sillyscript.sh</code>) doesn&#8217;t do much, but you get the idea:</p>
<p><code>#!/usr/bin/env bash<br />
MYLOGLINE=&quot;`date +&quot;%b %d %Y %H:%M&quot;` $0:&quot;<br />
echo &quot;$MYLOGLINE I&#8217;m alive!&quot;<br />
#uncomment to create an error<br />
#cp /testfoobar /tmp/`</code></p>
<p>And here is a simple <em>launchd</em>-plist to put the script in action:</p>
<p><code>&lt;?xml version=&quot;1.0" encoding=&quot;UTF-8&quot;?&gt;<br />
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br />
&lt;plist version=&quot;1.0&quot;&gt;<br />
&lt;dict&gt;<br />
    &lt;key&gt;label&lt;/key&gt;<br />
    &lt;string&gt;com.erikslab.sillyscript&lt;/string&gt;<br />
    &lt;key&gt;ProgramArguments&lt;/key&gt;<br />
    &lt;array&gt;<br />
        &lt;string&gt;/Users/Shared/sillyscript/sillyscript.sh&lt;/string&gt;<br />
    &lt;/array&gt;<br />
    &lt;key&gt;StandardErrorPath&lt;/key&gt;<br />
    &lt;string&gt;/Users/Shared/sillyscript/sillyscript_err.log&lt;/string&gt;<br />
    &lt;key&gt;StandardOutPath&lt;/key&gt;<br />
    &lt;string&gt;/Users/Shared/sillyscript/sillyscript.log&lt;/string&gt;<br />
    &lt;key&gt;StartInterval&lt;/key&gt;<br />
    &lt;integer&gt;120&lt;/integer&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</code></p>
<p>Note that everything takes place in a folder named <code>sillyscript</code> located in <code>/Users/Shared</code>, meaning if you want to start trying using the example shown, you would have to create that folder.</p>
<p>Now back to work. What? Still not satisfied? OK.</p>
<p>Use</p>
<p><code>launchctl load ~/Library/LaunchAgents/com.erikslab.sillyscript.plist</code></p>
<p>(after copying the file <code>com.erikslab.sillyscript.plist</code> to <code>~/Library/LaunchAgents</code> of course) and watch your logfile in <code>/Users/Shared/sillyscript/</code> grow in two-minute intervals.</p>
<p>Again, happy logging everyone. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  (And don&#8217;t forget to <code>launchctl unload</code> and remove the plist after you are done playing with it. )</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=3-hIGkq8PW8:pmSN8tXSEns:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=3-hIGkq8PW8:pmSN8tXSEns:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=3-hIGkq8PW8:pmSN8tXSEns:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=3-hIGkq8PW8:pmSN8tXSEns:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=3-hIGkq8PW8:pmSN8tXSEns:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=3-hIGkq8PW8:pmSN8tXSEns:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=3-hIGkq8PW8:pmSN8tXSEns:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=3-hIGkq8PW8:pmSN8tXSEns:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/3-hIGkq8PW8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2011/02/04/logging-with-launchd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access Special Folders via AppleScript</title>
		<link>http://erikslab.com/2010/10/09/access-special-folders-via-applescript/</link>
		<comments>http://erikslab.com/2010/10/09/access-special-folders-via-applescript/#comments</comments>
		<pubDate>Sat, 09 Oct 2010 10:14:30 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=70</guid>
		<description><![CDATA[There are certain folders which are not that easily accessible via AppleScript (or any other programming language for that matter) because the path to them has to be constructed by incorporating the (short) name of the current user account. One of the most used constructs would be accessing the folder Documents located in the user&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>There are certain folders which are not that easily accessible via <em>AppleScript</em> (or any other programming language for that matter) because the path to them has to be constructed by incorporating the (short) name of the current user account.</p>
<p>One of the most used constructs would be accessing the folder <code>Documents</code> located in the user&#8217;s <code>$HOME</code>, for example. The easiest way is the following string of commands:</p>
<p><code>set myDocumentFolder to path to documents folder as string</code></p>
<p>The result is the colon-delimited path as string, e.g. <code>MacHD:Users:username:Documents:</code>.</p>
<p>If you need the path to hand it over to a shell script or any other process requiring the Unix way of wording a path, use this approach:</p>
<p><code>set myDocumentFolder to POSIX path of (path to documents folder as string)</code></p>
<p>No surprise here, the answer will be something like this: <code>/Users/username/Documents</code>.</p>
<p>But what about accessing the user&#8217;s <code>Library</code> folder? If we continue like this:</p>
<p><code>set myUserLib to path to library folder as string</code></p>
<p>All we get is <code>MacHD:Library:</code>. Is there a way to tell <em>AppleScript</em> which <code>Library</code> folder we are really interested in? There sure is:</p>
<p><code>set myUserLib to path to library folder from user domain as string</code></p>
<p>Firing this command results in the path we are looking for: <code>MacHD:Users:username:Library:</code>. Telling <em>AppleScript</em> the <em>domain</em> we are interested in does the trick.</p>
<p>There are three <em>domains</em> at our disposal (there are actually some more, but those will be the subject of another post):</p>
<ul>
<li>user</li>
<li>local</li>
<li>system</li>
</ul>
<p>To cut a long story short, here are examples for the other two <em>domains</em> and the corresponding results:</p>
<ul>
<li><code>set myLocalLib to path to library folder from local domain as string</code> returns <code>MacHD:Library:</code></li>
<li><code>set mySystemLib to path to library folder from system domain as string</code> returns <code>MacHD:System:Library:</code></li>
</ul>
<p>It seems, that using <code>from local domain</code> is superfluous in regard of the folder <code>Library</code>, but good programming practice (and the resulting peace of mind) implies, that we should use the construct and be save from surprises later. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=aJ1PaNgMsYU:BzqznnuuyJA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=aJ1PaNgMsYU:BzqznnuuyJA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=aJ1PaNgMsYU:BzqznnuuyJA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=aJ1PaNgMsYU:BzqznnuuyJA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=aJ1PaNgMsYU:BzqznnuuyJA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=aJ1PaNgMsYU:BzqznnuuyJA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=aJ1PaNgMsYU:BzqznnuuyJA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=aJ1PaNgMsYU:BzqznnuuyJA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/aJ1PaNgMsYU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2010/10/09/access-special-folders-via-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X: Go to (certain) Pref-Panes fast</title>
		<link>http://erikslab.com/2009/11/10/os-x-go-to-certain-pref-panes-fast/</link>
		<comments>http://erikslab.com/2009/11/10/os-x-go-to-certain-pref-panes-fast/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 10:06:35 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=65</guid>
		<description><![CDATA[Did you know that there is a shortcut to open certain panes in System Preferences in OS X? If you want to open the Sound-Pane in System Preferences then try this key combination: &#x2325; – any of the keycaps to modify the volume on your Mac The same goes for the Monitors-Pane: &#x2325; – keycap [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know that there is a shortcut to open certain panes in <em>System Preferences</em> in <em>OS X</em>?</p>
<p>If you want to open the Sound-Pane in <i>System Preferences</i> then try this key combination:</p>
<p><kbd>&#x2325;</kbd> – <kbd>any of the keycaps to modify the volume on your Mac</kbd></p>
<p>The same goes for the Monitors-Pane:</p>
<p><kbd>&#x2325;</kbd> – <kbd>keycap to increase or decrease monitor backlight</kbd></p>
<p>Just a quick tip for the impatient. <img src='http://erikslab.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Works in 10.5.x and 10.6.x.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=53w3l_8cZIE:e7D-zpoK64Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=53w3l_8cZIE:e7D-zpoK64Q:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=53w3l_8cZIE:e7D-zpoK64Q:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=53w3l_8cZIE:e7D-zpoK64Q:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=53w3l_8cZIE:e7D-zpoK64Q:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=53w3l_8cZIE:e7D-zpoK64Q:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=53w3l_8cZIE:e7D-zpoK64Q:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=53w3l_8cZIE:e7D-zpoK64Q:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/53w3l_8cZIE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2009/11/10/os-x-go-to-certain-pref-panes-fast/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Diwali?</title>
		<link>http://erikslab.com/2009/10/17/diwali/</link>
		<comments>http://erikslab.com/2009/10/17/diwali/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 11:23:21 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[In case you need to know]]></category>

		<guid isPermaLink="false">http://erikslab.com/?p=62</guid>
		<description><![CDATA[Today is the festival Diwali, translated &#8220;a row of lamps&#8221;. Just in case you need to know. Get the whole story on Wikipedia or from the BBC.]]></description>
			<content:encoded><![CDATA[<p>Today is the festival <em>Diwali</em>, translated &#8220;a row of lamps&#8221;. Just in case you need to know.</p>
<p>Get the whole story on <a href="http://en.wikipedia.org/wiki/Diwali">Wikipedia</a> or from the <a href="http://www.bbc.co.uk/asiannetwork/features/diwali.shtml">BBC</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=jbsV-enxi70:wlB9Ld7tcx4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=jbsV-enxi70:wlB9Ld7tcx4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=jbsV-enxi70:wlB9Ld7tcx4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=jbsV-enxi70:wlB9Ld7tcx4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=jbsV-enxi70:wlB9Ld7tcx4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=jbsV-enxi70:wlB9Ld7tcx4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=jbsV-enxi70:wlB9Ld7tcx4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=jbsV-enxi70:wlB9Ld7tcx4:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/jbsV-enxi70" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2009/10/17/diwali/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tip: Launching Dashboard via AppleScript</title>
		<link>http://erikslab.com/2008/11/13/tip-launching-dashboard-via-applescript/</link>
		<comments>http://erikslab.com/2008/11/13/tip-launching-dashboard-via-applescript/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 08:26:13 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Dashboard]]></category>

		<guid isPermaLink="false">http://erikslab.com/2008/11/13/tip-launching-dashboard-via-applescript/</guid>
		<description><![CDATA[Just a short tip: Your Dashboard in OS X contains up to the minute information about things that are of interest to you, right? I use a script to launch iTunes and Mail in the morning while making coffee, the other thing I launch every morning is the Dashboard to get an overview of things [...]]]></description>
			<content:encoded><![CDATA[<p>Just a short tip: Your <em>Dashboard</em> in <em>OS X</em> contains up to the minute information about things that are of interest to you, right? I use a script to launch <i>iTunes</i> and <i>Mail</i> in the morning while making coffee, the other thing I launch every morning is the <em>Dashboard</em> to get an overview of things I want to know, e.g. weather-reports, stocks and the like.</p>
<p>It seems that it is not that widely known, that you are able to launch <em>Dashboard</em> via <em>AppleScript</em>, as well. If you got an error message like &#8216;Dashboard got an error: Application isn’t running.&#8217; while using <code>activate</code>, <code>launch</code> does the trick. It is as simple as that:</p>
<pre><code class="as">
<span class=bluebold>tell</span> <span class=bluereg>application</span> "Dashboard"
	<span class=bluereg>launch</span>
<span class=bluebold>end tell</span>
</code></pre>
<p>Bonus: If you are administering one or more <em>OS X servers</em>, then check your available Widgets in <em>Dashboard</em>, there is one to give you information about the vitals of your server(s).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=9qPrnzubu5E:sQxHlZjsSig:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=9qPrnzubu5E:sQxHlZjsSig:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=9qPrnzubu5E:sQxHlZjsSig:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=9qPrnzubu5E:sQxHlZjsSig:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=9qPrnzubu5E:sQxHlZjsSig:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=9qPrnzubu5E:sQxHlZjsSig:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=9qPrnzubu5E:sQxHlZjsSig:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=9qPrnzubu5E:sQxHlZjsSig:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/9qPrnzubu5E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2008/11/13/tip-launching-dashboard-via-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X: Daylight Savings Time switch and launchd</title>
		<link>http://erikslab.com/2008/10/27/os-x-daylight-savings-time-switch-and-launchd/</link>
		<comments>http://erikslab.com/2008/10/27/os-x-daylight-savings-time-switch-and-launchd/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 11:30:37 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[launchd]]></category>

		<guid isPermaLink="false">http://erikslab.com/2008/10/27/os-x-daylight-savings-time-switch-and-launchd/</guid>
		<description><![CDATA[The end of the Daylight Time is near, this year, the switch takes place on November 2nd, to be precise. Usually no biggie, but Europe switched back last weekend and I switched a couple of jobs from cron to launchd, as prescribed by Apple, during the year on servers located in Europe. cron, the one [...]]]></description>
			<content:encoded><![CDATA[<p>The end of the <a href="http://aa.usno.navy.mil/faq/docs/daylight_time.php">Daylight Time</a> is near, this year, the switch takes place on November 2nd, to be precise. Usually no biggie, but Europe switched back last weekend and I switched a couple of jobs from <code>cron</code> to <code>launchd</code>, as prescribed by Apple, during the year on servers located in Europe.</p>
<p><code>cron</code>, the one available on <em>OS X</em>, is capable of handling the switch from <em>daylight time</em> to &#8216;normal&#8217; without problems. Meaning jobs starting between 2 AM and 3AM won&#8217;t run twice. I always thought, that this behavior is built into <code>launchd</code> as well. Long story short: Three OS X Servers started the jobs twice last weekend.</p>
<p>Just an FYI in case you need to know.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/EriksLab?a=pcHoO5d7yas:zihoYEvo9XA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=pcHoO5d7yas:zihoYEvo9XA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=pcHoO5d7yas:zihoYEvo9XA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=pcHoO5d7yas:zihoYEvo9XA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=pcHoO5d7yas:zihoYEvo9XA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=pcHoO5d7yas:zihoYEvo9XA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/EriksLab?i=pcHoO5d7yas:zihoYEvo9XA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/EriksLab?a=pcHoO5d7yas:zihoYEvo9XA:dnMXMwOfBR0"><img src="http://feeds.feedburner.com/~ff/EriksLab?d=dnMXMwOfBR0" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/EriksLab/~4/pcHoO5d7yas" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://erikslab.com/2008/10/27/os-x-daylight-savings-time-switch-and-launchd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

