Developing a publish plugin. Some API questions

Community Beginner ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

SDK: I'm in the process of writing a publish plugin for our gallery software (Web Link Removed by Moderator). I've bumped into the following issues, hoping for help here 🙂 :

1) I see there is an LrShell.openFilesInApp API, but it requries the path to our app to be specified. Isn't there any way to simply have a file opened in the default app registered for that file type?

2) Isn't there some API to locate the "My Documents" folder in a language/platform neutral way? We want this plugin to be platform independent

3) When collection sets are created within our plugin, I want a collection child to be created automatically. I therefore implement publishServiceProvider.endDialogForCollectionSetSettings( publishSettings, info ). Now the problem is that even if the API specifies info.publishedCollectionSet as a reference for the newly created collection set, it's nil. These are the keys I have under the "info" parameter: isDefaultCollection, publishService, parents, name, collectionType, why, collectionSettings, pluginContext. What's happening here?

 

Thank you for your help.

TOPICS
SDK

Views

175

Likes

Translate

Translate

Report

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

correct answers 1 Correct Answer

LEGEND , Dec 02, 2020 Dec 02, 2020
"2) Isn't there some API to locate the "My Documents" folder in a language/platform neutral way? We want this plugin to be platform independent" See LrPathUtils.getStandardFilePath(). [Use the blue reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate
LEGEND ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

"1) I see there is an LrShell.openFilesInApp API, but it requries the path to our app to be specified. Isn't there any way to simply have a file opened in the default app registered for that file type?"

 

Use this idiom:

    local function openFileInApp (file)
        if WIN_ENV then
            LrShell.openFilesInApp ({""}, file) 
        else
            LrShell.openFilesInApp ({file}, "open")
            end
        end

 

Likes

Translate

Translate

Report

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 Beginner ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

Thank you. I would never have figured out that one by myself. It's awesome to be able to get this assistance from another user. We're running a support forum at jAlbum too since 2002. Even though we (the handful of us working at jAlbum) frequent our forum too to help users, most great replies to user questions are coming from a handful of dedicated users and plugin developers (we have gallery plugins called "skins"). I truly appreciate your help John!

Likes

Translate

Translate

Report

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 Beginner ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

Just commenting that I had to change the openInApp code like this to make it work on Windows too:

 

if WIN_ENV then
LrShell.openFilesInApp ({ file }, "explorer")
else
LrShell.openFilesInApp ({file}, "open")
end

 

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

"2) Isn't there some API to locate the "My Documents" folder in a language/platform neutral way? We want this plugin to be platform independent"

 

See LrPathUtils.getStandardFilePath().

 

[Use the blue reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate

Report

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 Beginner ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

Thank you. I don't know how I could have missed that one.

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

"3) When collection sets are created within our plugin, I want a collection child to be created automatically. I therefore implement publishServiceProvider.endDialogForCollectionSetSettings( publishSettings, info ). Now the problem is that even if the API specifies info.publishedCollectionSet as a reference for the newly created collection set, it's nil. These are the keys I have under the "info" parameter: isDefaultCollection, publishService, parents, name, collectionType, why, collectionSettings, pluginContext. What's happening here?"

 

I don't have any experience with publish service providers. Lets hope someone else expert in the SDK will reply.  Unfortunately, last year Adobe folded the SDK forum into this main LR forum, shrinking the number of regular participants from a small number down to 1 (me).

 

[Use the blue reply button under the first post to ensure replies sort properly.]

 

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

"if WIN_ENV then LrShell.openFilesInApp ({ file }, "explorer")"

 

What specifically happens when you use the code I posted? 

 

That code comes from my Any File plugin, which is used by a large number of people, and I haven't received any reports of it not working on Windows. (It works on my Windows 10.)

 

[Use the blue reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate

Report

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 Beginner ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

With your launch code, i.e. LrShell.openFilesInApp ({""}, file)  I get Windows error 1155: "No program is associated with the specified file for this action. When calling ShellExecuteExW from AgWorkspace.shellExecute.

 

Here's the original Swedish error dialogue:

Screenshot 2020-12-10 at 21.01.52.png

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

Interesting. I'm curious, what was the file type?  If you right-click the file in File Explorer and do Properties, is there a default app shown? E.g.

 

Untitled.png

Likes

Translate

Translate

Report

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 Beginner ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

It's a .jap file, a jAlbum Project File, and it's assigned fine in Explorer:

Screenshot 2020-12-10 at 22.55.26.png

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

Curious.

Likes

Translate

Translate

Report

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 Beginner ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

Naturally. The file type also shows up in Window's general list of file type assignments. I'm using an .msi package to set up file type assignements, like we've done for the last 15 years with jAlbum. Any downside to using the solution I've taken?

Likes

Translate

Translate

Report

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
LEGEND ,
Dec 11, 2020 Dec 11, 2020

Copy link to clipboard

Copied

LATEST

I don't see any obvious drawbacks to either approach, but since I don't know what LR is doing under the covers, I'm lacking any more technical insight.  If it becomes an issue, we can use Processor Monitor to perhaps uncover what LR is actually doing.

 

[Use the blue reply button under the first post to ensure replies sort properly.]

Likes

Translate

Translate

Report

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