Copy link to clipboard
Copied
Not sure this landed on the right place. Where is the scripting part of the forum? Was it deleted? All that work...
(This post is not a question.)
Below you will find a sample script for exporting LAB color swatches from InDesign. InDesign seem to have difficulties keeping thousands of swatches in its palette, so take care. A variant of this script made for Illustrator or Photoshop would probably have been a better idea.
/*
Script for exporting LAB colours from InDesign Swatches.
Number, Name, L, A, and B columns semi colon separated.
By Andreas Jansson, Code Combinations AB, Sweden, 2019.
Description:
First import a library of Pantone Colours so that they are present in the swatches palette of InDesign (you can export swatches from Photoshop, to an ASE file that is importable in InDesign).
Then alter the path below to a folder of your choice and run this script with InDesign.
The resulting file, I pasted into Excel.
*/
var result = '';
for (var i = 0; i <= app.swatches.length-1; i++){
var currentSwatch = app.swatches[i];
if (currentSwatch.hasOwnProperty('space') && currentSwatch.space == ColorSpace.LAB){
var val = currentSwatch.colorValue;
result += i.toString() + ';' + currentSwatch.name + ';' + val[0] + ';' + val[1] + ';' + val[2] + '\r\n';
}
}
result = 'N:o;Name;Lightness;A;B' + '\r\n' + result;
var outPath = 'C:/temp/test/out.txt'; // Put an existing path here
alert(writeToFile (result, outPath));
function writeToFile(fileContents, destinationFilePath){
var myFileOut = new File(destinationFilePath);
myFileOut.open('w');
// myFileOut.encoding = 'UTF-8';
myFileOut.write(fileContents);
myFileOut.close();
return new File(destinationFilePath).fsName;
}
Copy link to clipboard
Copied
Yes, in "English" but the friendly ".de" extension tells you this is not in the US. Weird.
It does not matter. I'm just saying...
Copy link to clipboard
Copied
Yes, in "English" but the friendly ".de" extension tells you this is not in the US. Weird.
It does not matter. I'm just saying...
By @Roger Breton
This should explain a lot:
https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#about.html
Copy link to clipboard
Copied
Hallo Robert,
Vielen danke fûr der dokumentation!!! Es ist wunderbar!!!
Copy link to clipboard
Copied
Hallo Robert,
Vielen danke fûr der dokumentation!!! Es ist wunderbar!!!
By @Roger Breton
It's not mine.