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

Script Event Manager... Possible to add "Open document from XD" as an event?

New Here ,
May 16, 2020 May 16, 2020

Copy link to clipboard

Copied

Looking for some guidance on the script event manager. I have created an action that I run on images with specific export settings. I work with a lot of my assets in XD, and often will click on an image in XD and select the "edit in Photoshop" option, which then opens the document in PS. I see that it is possible to have "Open a document" as an event in the script manager, but I am wondering if it is possible to link opening a document from XD to Photoshop as an event that will automatically trigger the action. Thanks

TOPICS
Actions and scripting

Views

1.7K

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
Adobe
Community Expert ,
May 16, 2020 May 16, 2020

Copy link to clipboard

Copied

The open event can run as script or an action. And  a script can use actions and a action can use scripts. The thing is an open event will be triggered with every open document no matter what created the document.  As far as I know Photoshop does not support a file type .XD.  Can Adobe XD export some file format that Photoshop supports.  If it does the Open Event handler must be able the distinguish if the file being open is one you want to process with your action.  That would most likely require you to write a script to make that determination and do your action if it is to be processed..

JJMack

Votes

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
Guide ,
May 16, 2020 May 16, 2020

Copy link to clipboard

Copied

XD does not transfer any special parameters to Photoshop, so the file opened as a result of "edit in Photoshop" cannot be distinguished from any other opening of the file. But you can use the file name or part of its path (for example, the name of the parent folder) to understand what exactly this file came from XD and, as a result, start the action you need. This is easily solved using scripts like that:

 

if (decodeURI(app.activeDocument.path).indexOf ('put your XD assets folder name here') != -1) app.doAction ('put here name of action', 'put here name of action set')

 

 (change variables to  your needs, save to *.jsx, put it to scripts folder, then add it to eventManager on document open event)

Votes

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
New Here ,
May 30, 2020 May 30, 2020

Copy link to clipboard

Copied

Thanks so much for your response! I've tried the script with the event manager but am still having trouble with it not triggering the action. I was wondering if the variable for the XD assets folder name needed to simply be the folder name (such as "XD Assets") or if it needs to be the full location/path of the folder on the machine. 

Votes

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
Guide ,
May 31, 2020 May 31, 2020

Copy link to clipboard

Copied

Unfortunately, I can’t install XD on my computer to check that moment (error 191, I communicate with support for several weeks and so far they can’t find a solution for my case), but it seems that the files are opened not from the project folder, but from the temporary directory:

2020-05-31_10-31-53.png

try to transfer the file to photoshop and execute the code

 

alert (decodeURI (app.activeDocument.path))

 

- it will show you the path from which the file is open.

Votes

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
Explorer ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

LATEST

Did you ever figure this out? I have exactly the same question - but want to use opening from Lightroom as a result of "edit in Photoshop"as an event trigger. "Open" works if I open the file from Photoshop, but not from Lightroom. Thanks.

Votes

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