Skip to main content
Known Participant
November 21, 2023
Question

SDK: Plugin dependent on application running

  • November 21, 2023
  • 1 reply
  • 565 views

Is it possible for a plugin (or scripts within a plugin) to work only if a particular application is running on the user's system? This would be macOS-specific.

 

If not, I could probably use LrFileUtils.exists( path ) to determine if an application exists but this wouldn't tell me if the application is running, just if it exists. 

 

Any tips would be greatly appreciated.

 

[Mod: Title edited to show it's SDK related]

This topic has been closed for replies.

1 reply

johnrellis
Legend
November 21, 2023

You could run the this command line using LrTasks.execute() to examine the list of running processes for the one you're interested in:

 

ps xo command > temp-file

 

I think you could also run an Applescript script that queries System Events for a process. But every time I turn to Applescript, there goes several hours of googling for all of its peculiarities.

cwurzbachAuthor
Known Participant
November 21, 2023

Thanks, @johnrellis - sort of related question, is it possible to have a plugin's menu items show only when certain conditions are met? 

johnrellis
Legend
November 21, 2023

"is it possible to have a plugin's menu items show only when certain conditions are met?"

 

Not in general. You can specify some conditions on selected photos (e.g. whether a photo is selected), as described in the SDK Programmer's Guide, but that's it.