XD 25 API update

Hi Everyone,

We have a small addition to the APIs in XD 25:

We have added the activeDocument field to the application module. By using this field, application.activeDocument, you are able to access user’s currently activated document’s name and guid. Please see examples in the docs.

Happy coding!

Steve

4 Likes

Please see my comment in https://github.com/AdobeXD/plugin-docs/pull/214#discussion_r358899217 :slightly_smiling_face:

1 Like

thanks Pablo - we will address it asap

1 Like

Is this the file name and guid of the entire project?

yeap at the document level

1 Like

Addressed. Thanks again for reporting this

1 Like

Is the guid of the active document the same as the rootNode guid?

The rootNode guid seems to be a constant (or was before 25).

In 24 and earlier, it’s "custom_guid_for_artwork".

Fantastic! Now, please add application.pid that gives the process ID, and application.startTime and I’ll be deliriously happy. :wink:

Use case

When building almost any kind of plugin licensing scheme, and checking in with a license server, we’d need to know how many different active XD sessions are trying to use the license.

Supplying the application.pid + '/' + application.startTime would give a solidly unique session id that we could depend on. (The chance of multiple XD applications having the same .pid and .startTime is ridiculously small.)

Otherwise, since plugins are essentially run per-document, if someone opened 3 documents, and the plugin checked in at its startup, it would look the same as if 3 users opened one document.

2 Likes

Active document guid same as root node guid :neutral_face:

1 Like

That’s ok for my use case but no good for you?

A native licensing scheme would be a great feature for plugins?!? Not to negate your feature requests.

It’s ok for me too, i just answer your question :wink:

1 Like