Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calling default app in Mac

Community Expert ,
May 19, 2009 May 19, 2009

On the PC, this launches a file phoPath in that file type's default application - eg a NEF opens directly in Capture NX if it is the Windows default for NEF files:

LrTasks.execute('"' .. phoPath .. '"')

But it doesn't seem to work on Mac. LrShell.openFilesInApp is no use here because it needs the name of the target application, which I don't want to hard code (because the user may have set some other app as the default).

Any thoughts? Can the SDK determine the Mac OS's default application for a file type? Or is there a way to get LrTasks to do the job?

John

TOPICS
SDK
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 19, 2009 May 19, 2009

You probably want to use the open command on Mac. It will look up the user-selected app for the files you're opening and launch it accordingly.

Type man open on the command line for details.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 19, 2009 May 19, 2009

Also, be aware that the Windows shell has some really wacky character escaping rules.

    LrTasks.execute('"' .. phoPath .. '"')

will probably fail for file names that contain certain special characters.

I've posted sample code here for working around this wackiness on the forums before. Don't have the link handy at the moment, but I think you would find it if you search the forum for LrTasks.execute.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2009 May 20, 2009
LATEST

Thanks Eric, that should help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines