<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Ruby, an AppleScript Alternative - Part 1</title>
	<atom:link href="http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html</link>
	<description>Tips, tools and code for iPhone and Mac developers.</description>
	<pubDate>Sun, 06 Jul 2008 23:28:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Stephane Gauvin</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-65</link>
		<dc:creator>Stephane Gauvin</dc:creator>
		<pubDate>Wed, 09 Apr 2008 14:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-65</guid>
		<description>Simply:

tell application "Terminal"
do script "ruby test2.rb /Users/gauvins/Desktop/test.txt"
end tell


it solved the broken path problem. I have not tried yet to pass values back and forth, but I foresee no major problem.

Sorry if the solution was painfully obvious and thanks for your time. I'll certainly devote some more time to learn ruby and rb-appscripts as they seem to be very efficient compared to applescript (probably because my problems have to deal with string manipulations, certainly not an applescript's strength)</description>
		<content:encoded><![CDATA[<p>Simply:</p>
<p>tell application &#8220;Terminal&#8221;<br />
do script &#8220;ruby test2.rb /Users/gauvins/Desktop/test.txt&#8221;<br />
end tell</p>
<p>it solved the broken path problem. I have not tried yet to pass values back and forth, but I foresee no major problem.</p>
<p>Sorry if the solution was painfully obvious and thanks for your time. I&#8217;ll certainly devote some more time to learn ruby and rb-appscripts as they seem to be very efficient compared to applescript (probably because my problems have to deal with string manipulations, certainly not an applescript&#8217;s strength)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-64</link>
		<dc:creator>john</dc:creator>
		<pubDate>Wed, 09 Apr 2008 13:35:35 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-64</guid>
		<description>Stephane,

At this point your best bet would probably be to submit the same question to the rb-appscript mailing list as I know there is number of eyes watching the posts:

http://rubyforge.org/mailman/listinfo/rb-appscript-discuss

I've had good luck and quick turn around using this approach. Hope that helps.

John</description>
		<content:encoded><![CDATA[<p>Stephane,</p>
<p>At this point your best bet would probably be to submit the same question to the rb-appscript mailing list as I know there is number of eyes watching the posts:</p>
<p><a href="http://rubyforge.org/mailman/listinfo/rb-appscript-discuss" rel="nofollow">http://rubyforge.org/mailman/listinfo/rb-appscript-discuss</a></p>
<p>I&#8217;ve had good luck and quick turn around using this approach. Hope that helps.</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephane Gauvin</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-63</link>
		<dc:creator>Stephane Gauvin</dc:creator>
		<pubDate>Wed, 09 Apr 2008 03:25:38 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-63</guid>
		<description>(thanks for your time)

The problem has to do with paths (I think). As an illustration -- the script below fails with the error message when called from an applescript: (I've installed rb-appscript 0.5.1 manually and with gems. No apparent difference ; run directly from the Terminal, test.rb executes)

--------
error
--------

/Users/gauvins/test.rb:1:in `require': no such file to load -- appscript (LoadError)
	from /Users/gauvins/test.rb:1

--------------
test.rb:
--------------

require "appscript"
include Appscript
puts app('TextWrangler').name.get

--------------------------------------
applescript (from the script editor):
--------------------------------------

set f to "/Users/gauvins/test.rb"
set s to "ruby " &#38; quoted form of f
do shell script s</description>
		<content:encoded><![CDATA[<p>(thanks for your time)</p>
<p>The problem has to do with paths (I think). As an illustration &#8212; the script below fails with the error message when called from an applescript: (I&#8217;ve installed rb-appscript 0.5.1 manually and with gems. No apparent difference ; run directly from the Terminal, test.rb executes)</p>
<p>&#8212;&#8212;&#8211;<br />
error<br />
&#8212;&#8212;&#8211;</p>
<p>/Users/gauvins/test.rb:1:in `require&#8217;: no such file to load &#8212; appscript (LoadError)<br />
	from /Users/gauvins/test.rb:1</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;<br />
test.rb:<br />
&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>require &#8220;appscript&#8221;<br />
include Appscript<br />
puts app(&#8217;TextWrangler&#8217;).name.get</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
applescript (from the script editor):<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>set f to &#8220;/Users/gauvins/test.rb&#8221;<br />
set s to &#8220;ruby &#8221; &amp; quoted form of f<br />
do shell script s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-62</link>
		<dc:creator>john</dc:creator>
		<pubDate>Tue, 08 Apr 2008 22:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-62</guid>
		<description>Stephane, 

If I run this code from within the Script Editor, ruby echo's back the command line parameter:

set params to "~/test.txt"
do shell script "ruby ~/ruby.rb " &#038; params

The ruby code is is one line:

puts $*

This assumes that the file test.rb is in my home directory /Users/John.

You could also use the code below, depending on what you are looking for:

set params to POSIX path of "~/test.txt"
do shell script "ruby ~/ruby.rb " &#038; params

Not sure if this is what you are looking for...</description>
		<content:encoded><![CDATA[<p>Stephane, </p>
<p>If I run this code from within the Script Editor, ruby echo&#8217;s back the command line parameter:</p>
<p>set params to &#8220;~/test.txt&#8221;<br />
do shell script &#8220;ruby ~/ruby.rb &#8221; &#038; params</p>
<p>The ruby code is is one line:</p>
<p>puts $*</p>
<p>This assumes that the file test.rb is in my home directory /Users/John.</p>
<p>You could also use the code below, depending on what you are looking for:</p>
<p>set params to POSIX path of &#8220;~/test.txt&#8221;<br />
do shell script &#8220;ruby ~/ruby.rb &#8221; &#038; params</p>
<p>Not sure if this is what you are looking for&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: john</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-61</link>
		<dc:creator>john</dc:creator>
		<pubDate>Tue, 08 Apr 2008 18:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-61</guid>
		<description>Which aspect fails? That is, does the ruby interpreter get called or does ruby produce an error when trying to access tst2.rb? If the later, you may need to specify the path to the file if it's not in the same directory as the shell.</description>
		<content:encoded><![CDATA[<p>Which aspect fails? That is, does the ruby interpreter get called or does ruby produce an error when trying to access tst2.rb? If the later, you may need to specify the path to the file if it&#8217;s not in the same directory as the shell.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephane Gauvin</title>
		<link>http://MacDeveloperTips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-60</link>
		<dc:creator>Stephane Gauvin</dc:creator>
		<pubDate>Tue, 08 Apr 2008 17:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://macdevelopertips.com/ruby/ruby-an-applescript-alternative-part-1.html#comment-60</guid>
		<description>I've installed rd-appscript. Calling a script from TERMINAL works fine. But I cannot figure how to call it from an APPLESCRIPT

Terminal: ruby test2.rb /Users/gauvins/Desktop/test.txt  (does work)

AppleScript: 

set the_params to "/Users/gauvins/Desktop/test.txt"
do shell script "ruby test2.rb " &#38; the_params

does not work. Including variants

Any idea? 

(I am not a developper at all. Just a poor soul trying to automate a very tedious task :)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve installed rd-appscript. Calling a script from TERMINAL works fine. But I cannot figure how to call it from an APPLESCRIPT</p>
<p>Terminal: ruby test2.rb /Users/gauvins/Desktop/test.txt  (does work)</p>
<p>AppleScript: </p>
<p>set the_params to &#8220;/Users/gauvins/Desktop/test.txt&#8221;<br />
do shell script &#8220;ruby test2.rb &#8221; &amp; the_params</p>
<p>does not work. Including variants</p>
<p>Any idea? </p>
<p>(I am not a developper at all. Just a poor soul trying to automate a very tedious task :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
