<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"
>

<channel>
	<title>High Earth Orbit &#187; Applescript</title>
	<atom:link href="http://highearthorbit.com/category/technology/programming/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://highearthorbit.com</link>
	<description>Transmitting ideas, observations, and images from 42,000 km.</description>
	<lastBuildDate>Thu, 27 Oct 2011 17:23:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RubyCocoa</title>
		<link>http://highearthorbit.com/rubycocoa/</link>
		<comments>http://highearthorbit.com/rubycocoa/#comments</comments>
		<pubDate>Fri, 04 Aug 2006 15:17:53 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Applescript]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://highearthorbit.com/rubycocoa/</guid>
		<description><![CDATA[RubyCocoa is a bridge between the Mac OS X Cocoa Framework API that makes it callable from Ruby code. You can create applications, objects, call Mac OS X Services. You can even call Applescript:

require 'osx/cocoa'
include OSX
def speak (str)
  str.gsub! (/"/, '\"')
  src = %(say "#{str}")
  NSAppleScript.alloc.initWithSource(src).executeAndReturnError(nil)
end
speak "Hello World!"
speak "Kon nich Wah. Ogan [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://rubycocoa.sourceforge.net/' title='RubyCocoa bridge'>RubyCocoa</a> is a bridge between the Mac OS X Cocoa Framework API that makes it callable from Ruby code. You can create applications, objects, call Mac OS X Services. You can even call Applescript:</p>
<pre><code>
require 'osx/cocoa'
include OSX
def speak (str)
  str.gsub! (/"/, '\"')
  src = %(say "#{str}")
  NSAppleScript.alloc.initWithSource(src).executeAndReturnError(nil)
end
speak "Hello World!"
speak "Kon nich Wah. Ogan key desu ka?"
</code></pre>
<p><a href='http://blog.bleything.ne' title='Ben Bleything blog'>Ben Bleything</a> submitted a talk to RubyConf, titled &#8220;<a href='http://blog.bleything.net/pages/harmonize'>Harmonize: Exploiting RubyCocoa and Sync Services for Fun and Profit</a>&#8221;  where he discusses making a wrapper around the SyncAPI in Ruby. (<a href='http://blog.bleything.net/articles/2006/08/04/introducing-harmonize' title='blethythingblog: Introducing Harmonize'>blog post introducing Harmonize</a>) </p>
<p><a href='http://rubycocoa.sourceforge.net/' title='RubyCocoa bridge'>RubyCocoa</a> looks like it may have stagnated a little as the last release was November 2005, but perhaps with such a renewed interest in <a href='http://radar.oreilly.com/archives/2006/07/ruby_book_sales_pass_perl.html' title="O'Reilly: Ruby Book Sales Pass Perl ">Ruby</a>, and Mac OS X gaining popularity, perhaps new life with be breathed into it. Projects such as <a href='http://www.syncbridge.com/' title='SyncBridge'>SyncBridge</a> and <a href='http://blog.bleything.net/pages/harmonize' title='Harmonize homepage'>Harmonize</a> also obviously help. </p>
<p><strong>Update</strong>: Check out the very good examples and information at <a href='http://www.rubycocoa.com/'>RubyCocoa.com</a>, including how to <a href='http://www.rubycocoa.com/appleremote/1'>use your Apple Remote from RubyCocoa</a> .</p>
<p class="tags">Tags: <a href="http://technorati.com/tag/ruby" title="See the Technorati tag page for 'ruby'." rel="tag">ruby</a>, <a href="http://technorati.com/tag/cocoa" title="See the Technorati tag page for 'cocoa'." rel="tag">cocoa</a>, <a href="http://technorati.com/tag/rubycocoa" title="See the Technorati tag page for 'rubycocoa'." rel="tag">rubycocoa</a>, <a href="http://technorati.com/tag/programming" title="See the Technorati tag page for 'programming'." rel="tag">programming</a>, <a href="http://technorati.com/tag/macosx" title="See the Technorati tag page for 'macosx'." rel="tag">macosx</a></p>]]></content:encoded>
			<wfw:commentRss>http://highearthorbit.com/rubycocoa/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Set Latitude &amp; Longitude of photos in iView Media Pro</title>
		<link>http://highearthorbit.com/set-latitude-longitude-in-iview-media-pro/</link>
		<comments>http://highearthorbit.com/set-latitude-longitude-in-iview-media-pro/#comments</comments>
		<pubDate>Wed, 28 Dec 2005 04:08:56 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Applescript]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://highearthorbit.com/set-latitude-longitude-in-iview-media-pro/</guid>
		<description><![CDATA[I&#8217;m making the transition to a much more stable, usable, and tool-rich photo management tool, iView Media Pro 3. I got tired of dealing with the incredibly slow interface to iPhoto thanks to Apple&#8217;s incapable handling &#038; testing of EXIF metadata in storing to their library.
But I digress.
Behold, there was scripting
&#8230; and it was good.
I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m making the transition to a much more stable, usable, and tool-rich photo management tool, <a href="">iView Media Pro 3</a>. I got tired of dealing with the <strong>incredibly</strong> slow interface to iPhoto thanks to Apple&#8217;s incapable handling &#038; testing of EXIF metadata in storing to their library.</p>
<p>But I digress.</p>
<h3>Behold, there was scripting</h3>
<p>&#8230; and it was good.</p>
<p>I had written an Applescript to <a href="http://highearthorbit.com/289/">set the latitude &#038; longitude</a> (and other location info) to selected photos in iPhoto. iPhoto was often beligerent and required a restart of the iPhoto (and possible database recreation) to read the location information (which was viewable in the &#8220;info&#8221; panel).</p>
<p>iView puts the location info as a user-editable set of fields in the EXIF data fields. Users can set city, region, country, etc. But for whatever reason, they are unable to change the latitude &#038; longitude.</p>
<p>I paired down my iPhoto script to just handle latitude &#038; longitude and handle getting the file name from iView. The tough part was how to get from the iView example <em>selected_images</em> to a useful POSIX path to feed to <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">exiftool</a>. This code does the trick.</p>
<pre><code>
set selectedID to selected_images(1)
if selectedID = {} then
	display dialog "No photos selected"
	return
end if

repeat with this_photo in selectedID
	set photo_path to path of this_photo
	set the image_file to the POSIX path of photo_path
</code></pre>
<h3>Installing &#038; Using the script</h3>
<p><a href="http://highearthorbit.com/wp-images/iViewLocation_latitude.jpg"><img src='http://highearthorbit.com/wp-images/thumb-iViewLocation_latitude.jpg' alt='iView Location Plugin - User Entry' align="right" hspace="10px"/></a><a href="http://highearthorbit.com/projects/applescript/SetLatLon.zip">Download the script here</a> and expand it in your <em>~/Library/Application Support/iView/Plug-ins/Scripts</em> folder and then reload iView.  You will also need <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/">exiftool</a>, as it is the real magic behind the smoke &#038; mirrors.</p>
<p>To use the script, select whatever photos you want to apply the <em>same</em> location information to. Then go to the &#8220;Scripts&#8221; icon in the menu bar, and choose the &#8220;Set Lat/Lon&#8221; script. Enter the latitude, longitude, and altitude in decimal format, pressing &#8220;OK&#8221; after each field. Wait a little while, and then a dialog will tell you how many photos were processed.</p>
<p><a href='http://highearthorbit.com/wp-images/iViewLocation_post_export.jpg' ><img src='http://highearthorbit.com/wp-images/thumb-iViewLocation_post_export.jpg' alt='iView Location Plugin - Post Export' align="right" hspace="10px"/></a>Back in iView, you should see the latitude &#038; longitude information in the right side-bar. You can also turn on lat/lon view in the thumbnail view by pressing <em>Command-J</em> and selecting &#8220;Latitude&#8221; &#8220;Longitude&#8221; &#8220;Altitude&#8221;. You may need to press <em>Command-B</em> to rebuild the thumbnail to have the info show up the first time (or on updates). </p>
<p>When exporting images (say to <a href="http://flickr.com">flickr!</a>), your geo-annotated data will stay intact and can then be <a href="http://geobloggers.com">mapped</a> (or <a href='http://www.flickrmap.com/'>mapped</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://highearthorbit.com/set-latitude-longitude-in-iview-media-pro/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Code paradigm converters</title>
		<link>http://highearthorbit.com/code-paradigm-converters/</link>
		<comments>http://highearthorbit.com/code-paradigm-converters/#comments</comments>
		<pubDate>Sun, 18 Dec 2005 18:12:50 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Applescript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://highearthorbit.com/code-paradigm-converters/</guid>
		<description><![CDATA[Sometimes people put together some useful, if perhaps odd, guides.
Applescript for Python Programmers is a set of tables mapping Python syntax, functions, and interfaces to the equivalent Applescript. Actually pretty nice for understanding both languages.
Are there others out there like this? Particularly I would think the following would be particularly useful:

C++ < -> Obj-C
Javascript < [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes people put together some useful, if perhaps odd, guides.</p>
<p><a href='http://aurelio.net/doc/as4pp.html'>Applescript for Python Programmers</a> is a set of tables mapping Python syntax, functions, and interfaces to the equivalent Applescript. Actually pretty nice for understanding both languages.</p>
<p>Are there others out there like this? Particularly I would think the following would be particularly useful:</p>
<ul>
<li>C++ < -> Obj-C</li>
<li>Javascript < -> PHP < -> Perl</li>
<li>HTML < -> XML/XSLT</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://highearthorbit.com/code-paradigm-converters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing iPhoto Exif Data</title>
		<link>http://highearthorbit.com/289/</link>
		<comments>http://highearthorbit.com/289/#comments</comments>
		<pubDate>Tue, 04 Oct 2005 11:48:25 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Applescript]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://highearthorbit.com/289/</guid>
		<description><![CDATA[Here is some quick Applescript that uses ExifTool to write Copyright, Title, Comments, and Keyword exif data to selected photos in iPhoto:
This script is released under the Creative Commons.


-- This applescript will set the exif keywords, name,
--  and comments of all selected iPhoto images using
--  the information current in iPhoto.
--
-- Author: Andrew Turner [...]]]></description>
			<content:encoded><![CDATA[<p>Here is some quick Applescript that uses <a href='http://www.sno.phy.queensu.ca/~phil/exiftool/'>ExifTool</a> to write Copyright, Title, Comments, and Keyword exif data to selected photos in iPhoto:</p>
<p>This script is released under the <a href='http://creativecommons.org/licenses/by/2.5/'>Creative Commons</a>.</p>
<pre>
<code>
-- This applescript will set the exif keywords, name,
--  and comments of all selected iPhoto images using
--  the information current in iPhoto.
--
-- Author: Andrew Turner (http://highearthorbit.com)
--
property copyright : ¬
		"Copyright Andrew Turner, 2005. All Rights Reserved."
property URL : "http://highearthorbit.com"
property exifToolOriginal : "_original"

-- True retains copyright, False means Public Domain
property Copyrighted : "True"

tell application "iPhoto"
	activate
	try
		copy (my selected_images()) to these_images
		if these_images is false or (the count of these_images) ¬
			is 0 then ¬
			error "Please select a single image."

		repeat with i from 1 to the count of these_images
			set the keywordslist to ""
			set this_photo to item i of these_images
			tell this_photo
				set the image_file to the image path
				set the image_title to the title
				set the image_filename to the image filename
				set the image_comment to the comment
				set the assigned_keywords to the name of keywords
			end tell
			repeat with j from 1 to the count of assigned_keywords
				set the keywordslist to keywordslist &#038; " -keywords+=" ¬
					&#038; item j of assigned_keywords
			end repeat
			set output to do shell script ¬
				"exiftool -title='" &#038; image_title &#038; ¬
				"' " &#038; keywordslist &#038; ¬
				" " &#038; " -comment='" &#038; image_comment &#038; ¬
				"' " &#038; " -Copyright='" &#038; copyright &#038; ¬
				"' " &#038; " -CopyrightNotice='" &#038; copyright &#038; ¬
				"' " &#038; " -Rights='" &#038; copyright &#038; ¬
				"' " &#038; " -Marked='" &#038; Copyrighted &#038; ¬
				"' " &#038; "'" &#038; image_file &#038; "'"
			do shell script "rm '" &#038; image_file &#038; "'" ¬
				&#038; exifToolOriginal
		end repeat

		display dialog "Exif writing complete."
	on error error_message number error_number
		if the error_number is not -128 then
			display dialog error_message buttons {"Cancel"} ¬
				default button 1
		end if
	end try
end tell

on selected_images()
	tell application "iPhoto"
		try
			-- get selection
			set these_items to the selection
			-- check for single album selected
			if the class of item 1 of these_items is album then error
			-- return the list of selected photos
			return these_items
		on error
			return false
		end try
	end tell
end selected_images
</code>
</pre>
<p>You can grab this script and a simpler Copyright only, as well as a Location (latitude/longitude/city,region,country) <a href='http://highearthorbit.com/projects/applescript/iPhotoExif.zip'>script here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://highearthorbit.com/289/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
	</channel>
</rss>

