• 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: openPanel using Automator Runner
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: openPanel using Automator Runner


  • Subject: Re: openPanel using Automator Runner
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 20 Jun 2013 09:11:18 +1000

On 20/06/2013, at 2:32 AM, Jim Skibbie <email@hidden> wrote:

>
> 	Sending a URL (e.g., "file://localhost/Users/jim/Movies/") does not work.

You will have to create an NSURL in your handler. I've been caught by this very problem: 10.6 will accept a path, but later versions will not. See below. But your basic approach is reasonable, if a lot of work for what seems to an outsider a small-ish thing.

> Does running Applescript Objective-C natively in an Applescript script get easier in OS X 10.8+?

Anyone who knows the answer to that question can't answer -- 10.9 is still mostly covered by NDA.

> is the ASObjC Runner my best option to pass ASObjC snippets inside vanilla Applescript?

You could also save it as what AppleScript Editor calls a Cocoa-AppleScript app. These were introduced in 10.7, but they work fine in 10.6. It's just a matter of getting hold of one of the applets and replacing the main.scpt in its bundle with your ASObjC code. Come to think of it, that's probably not a good plan given your need to pass arguments.

But given you know haw to write ASObjC, you'd probably be better to write your own simple helper app, and cut out the middle man. You can pass the arguments when opening using the shell and get them using:

 set theArgs to current application's NSProcessInfo's processInfo()'s arguments()

> set theDir to current application's NSApp's passedValue() as text

However you get theDir, turn it into an NSURL and use that:

 set theURL to current application's NSURL's fileURLWithPath_(theDir)

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


References: 
 >Re: openPanel using Automator Runner (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: openPanel using Automator Runner
  • Next by Date: Script for moving files.
  • Previous by thread: Re: openPanel using Automator Runner
  • Next by thread: use applescript to import contacts
  • Index(es):
    • Date
    • Thread