Re: Filtering files in NSOpenPanel that NSAppleScript can run
Re: Filtering files in NSOpenPanel that NSAppleScript can run
- Subject: Re: Filtering files in NSOpenPanel that NSAppleScript can run
- From: "Adam R. Maxwell" <email@hidden>
- Date: Thu, 16 Nov 2006 20:55:09 -0800
On Nov 16, 2006, at 10:32, Sean McBride wrote:
Hi all,
I'd like to allow users to select an arbitrary AppleScript that my app
will in turn run.
NSAppleScript has initWithContentsOfURL:error: which is perfect for
this. But what kind of files will it accept? The docs say "either
text
or compiled form" but in Script Editor's 'save as' I count 5 formats.
Is there a way to display an NSOpenPanel that will allow the user to
select only files that initWithContentsOfURL:error: can deal with?
Something akin to [NSBitmapImageRep imageFileTypes].
There appear to be no UTIs for AppleScript. The only thing I can
think
of is to preflight each file by calling initWithContentsOfURL:error:
and
see if it fails (likely slow) or hardcoding the 5 extensions that
today's Script Editor can save (not future-proof).
It has UTIs com.apple.applescript.script and
com.apple.applescript.text, according to <http://www.devworld.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html
>. I recently discovered these while trying to do the exact same
thing.
hth,
Adam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden