• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Filtering files in NSOpenPanel that NSAppleScript can run
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Filtering files in NSOpenPanel that NSAppleScript can run
      • From: "Sean McBride" <email@hidden>
References: 
 >Filtering files in NSOpenPanel that NSAppleScript can run (From: "Sean McBride" <email@hidden>)

  • Prev by Date: [ANN] ODBCKit 0.2.0
  • Next by Date: Re: NSScrollView bug or misunderstood behavior?
  • Previous by thread: Filtering files in NSOpenPanel that NSAppleScript can run
  • Next by thread: Re: Filtering files in NSOpenPanel that NSAppleScript can run
  • Index(es):
    • Date
    • Thread