<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How to make this automator action?</title>
	<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action/</link>
	<description>Comments on Ask MetaFilter post How to make this automator action?</description>
	<pubDate>Fri, 30 Jun 2006 19:19:14 -0800</pubDate>
	<lastBuildDate>Fri, 30 Jun 2006 19:19:14 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How to make this automator action?</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action</link>	
		<description>Tearing my hair out over automator and applescript. &lt;br /&gt;&lt;br /&gt; I&apos;m trying to create an action that will change my desktop background: display photos of morning scenes in the morning, evening scenes in the evening, day scenes in the day, etc.&lt;br&gt;
&lt;br&gt;
I&apos;ve glue-sticked together an applescript that will find out the time and and put it in a variable as one of three words: morning, day, evening and night.&lt;br&gt;
&lt;br&gt;
&lt;small&gt;&lt;code&gt;set TheDate to current date&lt;br&gt;
set theDateText to TheDate as text&lt;br&gt;
set theTime to time of TheDate&lt;br&gt;
set theHour to theTime div 3600&lt;br&gt;
&lt;br&gt;
if theHour &amp;gt; 6 and theHour &lt; 11 then set thename to morning end if if thehour&gt; 10 and theHour &lt; 19 then set thename to day end if if thehour&gt; 18 and theHour &lt; 23 then set thename to evening end if if thehour&gt; 22 then&lt;br&gt;
	set theName to &quot;night&quot;&lt;br&gt;
end if&lt;br&gt;
&lt;br&gt;
if theHour &lt; 7 then set thename to night end if/code&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/code&gt;&lt;/small&gt;&lt;br&gt;
&lt;br&gt;
But I can&apos;t for the life of me figure out how to get that variable into the next automator step, even though I have folders in ~/Backgrounds named &quot;morning&quot; &quot;day&quot; &quot;evening&quot; and &quot;night&quot; full of flickr images ready and waiting the be fetched randomly and plugged into automator&apos;s built-in &quot;set as desktop background&quot; step.  I can get &quot;day&quot; (or &quot;evening&quot; or whatever) to get entered into spotlight, but that doesn&apos;t do much good.&lt;br&gt;
&lt;br&gt;
(It would be even cooler if someone knew of a way to pull the photos straight from flickr, but that sounds hard.  I am, it should be obvious at this point, not a programmer at heart.)</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.41273</guid>
		<pubDate>Fri, 30 Jun 2006 19:16:08 -0800</pubDate>
		<dc:creator>Tlogmer</dc:creator>
		
			<category>applescript</category>
		
			<category>automator</category>
		
			<category>osx</category>
		
			<category>mac</category>
		
			<category>macintosh</category>
		
			<category>apple</category>
		
			<category>programming</category>
		
			<category>scripting</category>
		
	</item> <item>
		<title>By: Tlogmer</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635551</link>	
		<description>Wow.  That applescript worked on preview.  &lt;a href=&quot;http://benyates.info/automator.txt&quot;&gt;Here it is as a text file.&lt;/a&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635551</guid>
		<pubDate>Fri, 30 Jun 2006 19:19:14 -0800</pubDate>
		<dc:creator>Tlogmer</dc:creator>
	</item><item>
		<title>By: kindall</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635575</link>	
		<description>make the last line of the script&lt;br&gt;
&lt;br&gt;
&lt;tt&gt;get thename&lt;/tt&gt;&lt;br&gt;
&lt;br&gt;
This casuse the result of the script to be the value of this variable.  This should be passed on to the next step in Automator.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635575</guid>
		<pubDate>Fri, 30 Jun 2006 20:07:37 -0800</pubDate>
		<dc:creator>kindall</dc:creator>
	</item><item>
		<title>By: cillit bang</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635583</link>	
		<description>This should work:&lt;br&gt;
&lt;pre&gt;on run {input, parameters}&lt;br&gt;    set foldername to &quot;whatever&quot;&lt;br&gt;    &lt;br&gt;    set fullpath to &quot;Macintosh HD:path:to:folder:&quot; &amp;amp; foldername &amp;amp; &quot;:&quot;&lt;br&gt;    &lt;br&gt;    tell application &quot;Finder&quot; to set piclist to every item of folder fullpath&lt;br&gt;    &lt;br&gt;    set n to number in piclist&lt;br&gt;    &lt;br&gt;    set picpath to item (random number from 1 to n) of piclist as string&lt;br&gt;    &lt;br&gt;    return (POSIX path of picpath) as string&lt;br&gt;    &lt;br&gt;end run&lt;/pre&gt;But because Applescript and/or Automator suck, it doesn&apos;t. It does return a path, but the desktop picture doesn&apos;t change. For some reason, if you paste that path into the source code as a string, so that the script returns &lt;i&gt;exactly the same thing&lt;/i&gt; it does work. I give up.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635583</guid>
		<pubDate>Fri, 30 Jun 2006 20:24:45 -0800</pubDate>
		<dc:creator>cillit bang</dc:creator>
	</item><item>
		<title>By: Tlogmer</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635593</link>	
		<description>Kindall: Sorry, bad phrasing on my part.  I can get it to the next automator action (using apple&apos;s default applescript-in-automator framework, though your way&apos;s cleaner) but the only action I can find that will &lt;i&gt;accept&lt;/i&gt; the string is Spotlight -- and spotlight won&apos;t pass it on to finder.&lt;br&gt;
&lt;br&gt;
cillit: hm.  Maybe I should get back to attempting to learn objective-C.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635593</guid>
		<pubDate>Fri, 30 Jun 2006 20:46:44 -0800</pubDate>
		<dc:creator>Tlogmer</dc:creator>
	</item><item>
		<title>By: cillit bang</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635604</link>	
		<description>Ok, this works:&lt;pre&gt;on run {input, parameters}&lt;br&gt;    set theName to &quot;pics&quot;&lt;br&gt;    &lt;br&gt;    set fullpath to &quot;Macintosh HD:path:to:folder&quot; &amp;amp; theName &amp;amp; &quot;:&quot;&lt;br&gt;    &lt;br&gt;    tell application &quot;Finder&quot; to set piclist to every item of folder fullpath&lt;br&gt;    &lt;br&gt;    set n to number in piclist&lt;br&gt;    &lt;br&gt;    set filename to name of item (random number from 1 to n) of piclist&lt;br&gt;    &lt;br&gt;    return &quot;/path/to/folder/&quot; &amp;amp; theName &amp;amp; &quot;/&quot; &amp;amp; filename&lt;br&gt;    &lt;br&gt;end run&lt;/pre&gt;Replace the first line with your code and change the paths on the second and last lines to wherever your folders are (and yes, you need to use two different path formats, such is the magic of Applescript).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635604</guid>
		<pubDate>Fri, 30 Jun 2006 21:01:28 -0800</pubDate>
		<dc:creator>cillit bang</dc:creator>
	</item><item>
		<title>By: Tlogmer</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635605</link>	
		<description>&lt;a href=&quot;http://benyates.info/daylightimage.txt&quot;&gt;I figured it out entirely in applescript&lt;/a&gt; =D</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635605</guid>
		<pubDate>Fri, 30 Jun 2006 21:05:27 -0800</pubDate>
		<dc:creator>Tlogmer</dc:creator>
	</item><item>
		<title>By: Tlogmer</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635606</link>	
		<description>Shit, beaten to the punch.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635606</guid>
		<pubDate>Fri, 30 Jun 2006 21:05:40 -0800</pubDate>
		<dc:creator>Tlogmer</dc:creator>
	</item><item>
		<title>By: cillit bang</title>
		<link>http://ask.metafilter.com/41273/How-to-make-this-automator-action#635607</link>	
		<description>&lt;pre&gt;set fullpath to &quot;Macintosh HD:path:to:folder&quot; &amp;amp; theName &amp;amp;&quot;:&quot;&lt;/pre&gt;should be&lt;pre&gt;set fullpath to &quot;Macintosh HD:path:to:folder&lt;b&gt;:&lt;/b&gt;&quot; &amp;amp; theName &amp;amp;&quot;:&quot;&lt;/pre&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.41273-635607</guid>
		<pubDate>Fri, 30 Jun 2006 21:05:58 -0800</pubDate>
		<dc:creator>cillit bang</dc:creator>
	</item>
	</channel>
</rss>
