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

InDesign layers to Photoshop JS Version

Community Expert ,
Oct 05, 2020 Oct 05, 2020

Copy link to clipboard

Copied

If anyone is interested in a Javascipt version of my InDesign to Photoshop Layers AppleScript, I’ve converted it to JS via BridgeTalk and the current version is here:

 

https://www.dropbox.com/scl/fo/fgl2b67v7iuyu701twgc9/h?rlkey=gygixac74tr4mp9l87oa2l1a9&dl=0

 

 

Click the Download link, save to your InDesign Scripts folder, where you can run it from the Scripts panel. I also included a layered test ID file.

 

I have tested on OSX High Sierra with CC2020, and it seems to work fine, but would welcome feedback if there are any problems.

 

The original forum thread from 2015:

 

https://community.adobe.com/t5/indesign/how-to-export-indesign-layers-to-photoshop-layers-same-struc...

 

https://shared-assets.adobe.com/link/5aa6cfc2-d1bf-47e1-6b6b-70aec58f38b5

https://shared-assets.adobe.com/link/5aa6cfc2-d1bf-47e1-6b6b-70aec58f38b5

 

 

TOPICS
Import and export , Scripting

Views

2.2K

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

Community Expert , Oct 06, 2020 Oct 06, 2020

Hi Uwe, The JS vesion is storing the exported layers in the OS’s temp folder. I can see that it is working on OSX, but don’t have a Windows machine to test on. If you get a chance could you try it on Windows. Thanks.

Votes

Translate

Translate
Community Expert ,
Oct 05, 2020 Oct 05, 2020

Copy link to clipboard

Copied

Thanks, Rob!

David Creamer: Community Expert (ACI and ACE 1995-2023)

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
Community Expert ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

Thank you very much, Rob!

 

Regards,
Uwe Laubender

( ACP )

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
Community Expert ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

Hi Uwe, The JS vesion is storing the exported layers in the OS’s temp folder. I can see that it is working on OSX, but don’t have a Windows machine to test on. If you get a chance could you try it on Windows. 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
Community Expert ,
Oct 06, 2020 Oct 06, 2020

Copy link to clipboard

Copied

Hi Rob,

will test and debug your code the next days. A first try, just running your script on your provided INDD document, failed.

This is the core error message where I translated the German parts:

 

/*
JavaScript Error!
Error number: 2
Error message: rgbProf is undefined
Line: 189
*/

 

 

An "Adobe Illustrator" file, I know it's a PDF with ai suffix, was showing up in a temp folder in my user folder under:

 

Error-2-rgbProf-is-undefined-TempFileCreated.PNG

Did not look much into the code, so I have no clue what exactly went wrong.Your test document was left in the following state after I answered the error message:

 

Error-2-rgbProf-is-undefined-StateOfTheDocAfterError.PNG

 

First hint:

 

var rgbProf = doc.rgbProfile; // returns "sRGB IEC61966-2.1"

 

 

So that should work. But obviously bt.body in line 189 does not work as expected. Hm. Maybe it's the target declaration two lines before? I cannot see that PhotoShop is starting up. Maybe the string "photoshop" is not enough. Have to run BridgeTalk Diagnostics to get a reliable string first.

 

Will be back tomorrow.

 

Regards,
Uwe Laubender

( ACP )

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
Community Expert ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

Hi Uwe, thanks for testing. I did discover a bug this morning that might be related. I was trying to store the dialog results in an object, which threw an error when I cancelled.

 

I posted an update in the same folder. The new code moves the rgbProf variable into the function with Bridgetalk, so it might help with the error you were getting.

 

https://shared-assets.adobe.com/link/5aa6cfc2-d1bf-47e1-6b6b-70aec58f38b5

 

Also, the .ai extension is intentional. When the PS layers are smart objects, double clicking to edit will open the layer in Illustrator.

 

 

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
Advocate ,
Jan 23, 2024 Jan 23, 2024

Copy link to clipboard

Copied

Thats pretty clever storing the PDF as a AI while its actually a PDF with ai editablity

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
Community Expert ,
Oct 08, 2020 Oct 08, 2020

Copy link to clipboard

Copied

Latest is ExportLayersToPSv3.jsx

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
Community Expert ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

Hi Rob,

just did a quick test with your version 3 script, ExportLayersToPSv3.jsx, that I executed from the User folder of my Scripts panel in my German InDesign 2020 on Windows 10. Did not change the default values the script's UI offered.

 

All was working as expected:

 

PhotoShop started.

Four files were written to the temp folder with suffix ai.

Four named layers plus a background layer were created in a new PhotoShop file.

The suggested name of the not saved PhotoShop file is exactly the one from the InDesign document without suffix.

The names of the four layers are exactly the names of the layers of the InDesign document.

The stacking order of the layers is the same in both documents.

All the named layers in PhotoShop contain one smart object each.

The size of the PhotoShop file corresponds with the one of the InDesign page: 612 x 792 Pt.

 

Will test with my own stuff later…

 

Thanks,
Uwe Laubender

( ACP )

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
Community Expert ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

Thanks Uwe, I think it was the way I had set up the dialog results—seems to be better now.

 

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 ,
Jan 11, 2022 Jan 11, 2022

Copy link to clipboard

Copied

Thank you so much for the script Rob!  I downloaded this version "ExportLayersToPSv4" and it works geat on my PC with InDesign 2022.  I tried few other scripts before I found yours, non of them work.

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
Community Expert ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

quote

 

 

https://shared-assets.adobe.com/link/11873033-f682-4425-68bd-239afeda1e0f

 


By @rob day

 

Error 404: Asset not found
This asset isn’t available. Try checking the URL or visit a different page

 

is there a newer/working version that will work w/ id2022, 17.4.1 on sonoma 14.4.1 mac os intel  please ?

i can't believe indesign does not have this export layers built in to scripts or capabilities!

 

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
Community Expert ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

Might be because the link is to my Adobe CC account and they are discontinuing file sharing. Here it is in Dropbox—I have not tested with the latest updates on Sonoma.

 

https://www.dropbox.com/scl/fo/fgl2b67v7iuyu701twgc9/h?rlkey=gygixac74tr4mp9l87oa2l1a9&dl=0

 

 

 

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

quote

Might be because the link is to my Adobe CC account and they are discontinuing file sharing. Here it is in Dropbox—I have not tested with the latest updates on Sonoma.

 

https://www.dropbox.com/scl/fo/fgl2b67v7iuyu701twgc9/h?rlkey=gygixac74tr4mp9l87oa2l1a9&dl=0


By @rob day

 

Thanks so much. (will post back if it doesn't work for me on my system) appreciated!!

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

so far not working but  i will restart ID & then imac if errors (many) continue

 

errors like:

Line 44: executeAction( cTID('Plc '), placeAction, DialogModes.NO );
General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
Error in
Line 1:
The command “Place” is not currently available.

Can’t make -0.125 into type «class ÅPXå». (-1700)

Could not open “LayerTest.ai” because of a disk error.

& similar

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

one of a number of errors. will restart all to see if resolves. advice welcome

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

very first error is

Photoshop

Could not open “S color.ai” because of a disk error.

 

followed by a ton of ID errors, some of which prev. noted

 

my ID & PSP working files are on a separate SSD drive than my internal applications imac SSD if that matters.

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
Community Beginner ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

restarted all including imac still not working. most if not all ID errors (after the Photoshop  Could not open “file color.ai” because of a disk error.) say

The command “Place” is not currently available.

and one or 2 each of:

Cannot open the file because the open options are incorrect. or

Line 4: var doc = app.activeDocument;
No such element

 

fwiw . 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
Community Expert ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

I have not tested in Sonoma.

 

Are you running the script from InDesign’s Scripts panel?

 

I just checked with InDesign 19.1 and Photoshop 25.2 running on Ventura and it worked without any problems.

 

Screen Shot 10.png

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
Community Expert ,
Mar 31, 2024 Mar 31, 2024

Copy link to clipboard

Copied

LATEST

I had a chance to check some more this weekend, and the errors you are getting would happen if the PDFs of the layers were not written or found (could be a Somoma permissions problem). I’ve added some error handling and made the timeout longer on the Photoshop file placing. Can’t test in Sonoma, but see if this works.

 

https://www.dropbox.com/scl/fo/fgl2b67v7iuyu701twgc9/h?rlkey=gygixac74tr4mp9l87oa2l1a9&dl=0

 

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
Community Expert ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

my ID & PSP working files are on a separate SSD drive than my internal applications imac SSD if that matters.

 

Maybe try testing an InDesign file saved to your Desktop or somewhere on the startup drive. Run from your InDesign Scripts folder with PS running.

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