Re: Call Objective-C methods from any script
Re: Call Objective-C methods from any script
- Subject: Re: Call Objective-C methods from any script
- From: daniel <email@hidden>
- Date: Mon, 17 Jan 2005 13:40:45 -0800
If you make the LSBackgroundOnly flag true for the app, it behaves
almost just like a scripting addition. The only caveat being you have
to address it as an application, still. I've posted my very simple
app, named "AppleScriptKit":
http://www.red-sweater.com/AppleScriptKit.zip
Simply download this and leave it on your computer. Now you can use all
of the AppleScript studio methods by using tell application
"AppleScriptKit" blocks!
Daniel
On Jan 17, 2005, at 12:53 PM, Paul Berkowitz wrote:
That's a great idea. It's occurred to me too, but I had not come up
with
your workaround for a stand-in Studio app in the meantime. That's
excellent
too, for now. It would be really great to be able to access 'call
method' as
a scripting addition for all methods of existing Cocoa (AppKit and
Foundation) classes from any AppleScript.
--
Paul Berkowitz
From: daniel <email@hidden>
Date: Mon, 17 Jan 2005 12:33:35 -0800
To: AppleScript-Users Users <email@hidden>
Subject: Call Objective-C methods from any script
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?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com
This email sent to email@hidden
_______________________________________________
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