Call Objective-C methods from any script
Call Objective-C methods from any script
- Subject: Call Objective-C methods from any script
- From: daniel <email@hidden>
- Date: Mon, 17 Jan 2005 12:33:35 -0800
It occurred to me that it would be cool for any script to be able to
take advantage of the "call method" functionality included with
AppleScript Studio applications. An interesting way of getting this is
simply to make a "stand-in" AppleScript Studio application to do your
bidding. For example, if you produce an empty AS Studio app named
"MyTestApp", then you can use it to access the wealth of Cocoa and
Foundation classes:
WebSafeString("http://www.apple.com/Fun with spaces.html")
on WebSafeString(myString)
tell application "MyTestApp"
set myURLString to call method "stringWithString:" of class
"NSString" with parameter myString
set myFixedURLString to call method
"stringByAddingPercentEscapesUsingEncoding:" of myURLString with
parameter 30
end tell
end WebSafeString
--> "http://www.apple.com/Fun with spaces.html"
Maybe others have already figured this out but I thought it was a
pretty nifty hack. Maybe it wouldn't be too hard to put together a
Scripting Addition that bridged all the AppleScriptKit terminologies to
regular scripts?
Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden