<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Calling AppleScript Handlers from Cocoa</title>
	<link>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/</link>
	<description>Buzz Andersen's Weblog</description>
	<pubDate>Sat, 19 Jul 2008 20:12:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Blake Seely</title>
		<link>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-3388</link>
		<dc:creator>Blake Seely</dc:creator>
		<pubDate>Mon, 21 Nov 2005 06:21:22 +0000</pubDate>
		<guid>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-3388</guid>
		<description>Whew! I had a need today to call an AppleScript from a cocoa app - and be able to target a specific handler inside that script. I read through all the NSAppleScript and NSappleEventDescriptor docs, read a few things on the web and was figuring I'd have to write something like this! Now I don't, and you have no idea how happy that makes me :) Thanks, Buzz.</description>
		<content:encoded><![CDATA[<p>Whew! I had a need today to call an AppleScript from a cocoa app - and be able to target a specific handler inside that script. I read through all the NSAppleScript and NSappleEventDescriptor docs, read a few things on the web and was figuring I&#8217;d have to write something like this! Now I don&#8217;t, and you have no idea how happy that makes me <img src='http://weblog.scifihifi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Thanks, Buzz.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt neuburg</title>
		<link>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-1222</link>
		<dc:creator>matt neuburg</dc:creator>
		<pubDate>Thu, 15 Sep 2005 00:40:52 +0000</pubDate>
		<guid>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-1222</guid>
		<description>The fatal flaw is this line:

subroutineDescriptor = [NSAppleEventDescriptor descriptorWithString: handler];

It should be:

subroutineDescriptor = [NSAppleEventDescriptor descriptorWithString: [handler lowercaseString]];

The example stacks the deck with a handler whose real name *is* lowercase, but of course in real life that's unlikely, and the example code will break. For more info, see:

http://developer.apple.com/qa/qa2001/qa1111.html

And for a working formulation:

http://www.cocoadev.com/index.pl?CallAppleScriptFunction

Hope this helps - m.

</description>
		<content:encoded><![CDATA[<p>The fatal flaw is this line:</p>
<p>subroutineDescriptor = [NSAppleEventDescriptor descriptorWithString: handler];</p>
<p>It should be:</p>
<p>subroutineDescriptor = [NSAppleEventDescriptor descriptorWithString: [handler lowercaseString]];</p>
<p>The example stacks the deck with a handler whose real name *is* lowercase, but of course in real life that&#8217;s unlikely, and the example code will break. For more info, see:</p>
<p><a href="http://developer.apple.com/qa/qa2001/qa1111.html" rel="nofollow">http://developer.apple.com/qa/qa2001/qa1111.html</a></p>
<p>And for a working formulation:</p>
<p><a href="http://www.cocoadev.com/index.pl?CallAppleScriptFunction" rel="nofollow">http://www.cocoadev.com/index.pl?CallAppleScriptFunction</a></p>
<p>Hope this helps - m.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Anderson</title>
		<link>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-109</link>
		<dc:creator>Ian Anderson</dc:creator>
		<pubDate>Thu, 28 Apr 2005 17:36:36 +0000</pubDate>
		<guid>http://weblog.scifihifi.com/2004/04/15/calling-applescript-handlers-from-cocoa/#comment-109</guid>
		<description>Why not use symbolic names from  instead of using hardcoded four character codes?  Like kASAppleScriptSuite, kASSubroutineEvent, and keyASSubroutineName.

I don't think it's required to set the targetDescriptor: parameter when making the Apple Event to send to a script.  I just use +[NSAppleEventDescriptor nullDescriptor] and it works fine.</description>
		<content:encoded><![CDATA[<p>Why not use symbolic names from  instead of using hardcoded four character codes?  Like kASAppleScriptSuite, kASSubroutineEvent, and keyASSubroutineName.</p>
<p>I don&#8217;t think it&#8217;s required to set the targetDescriptor: parameter when making the Apple Event to send to a script.  I just use +[NSAppleEventDescriptor nullDescriptor] and it works fine.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
