Copy link to clipboard
Copied
Hello brains of InDesign...
I have a 40 pg document that has a whole series of products listed in it - upwards of 400 products. Each product has a product number that is setup in its own character style. I was asked if we can export an excel file that shows the product number and the page it's on. Is there a simple way of doing this? I believe there may be a script to run, but i have no idea where to find something so specific like this.
Any help?
Thanks!
Here is a JSX simplistic script that should do what you need.
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "Your Style Name";
var fs = app.activeDocument.findText();
var a = [];
var pp;
for (var i = 0; i < fs.length; i++) {
try {
pp = fs[i].parentTextFrames[0].parentPage.name;
} catch(e) {
//textframe probably in pasteboard
pp = "PB";
}
a.push(fs[i].contents + "," + pp);
}
var f = File(Folder.desktop + "/sku-log.csv");
f
...
Copy link to clipboard
Copied
3rd party developer created plugin ins to connect to data bases and Excel. Some of them allow 2-ways, from the DB to InDesign and if you make changes or add something back to the DB. Search for DB connections to InDesign. Those Plugins are not cheap, but useful.
Copy link to clipboard
Copied
Here is a JSX simplistic script that should do what you need.
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = "Your Style Name";
var fs = app.activeDocument.findText();
var a = [];
var pp;
for (var i = 0; i < fs.length; i++) {
try {
pp = fs[i].parentTextFrames[0].parentPage.name;
} catch(e) {
//textframe probably in pasteboard
pp = "PB";
}
a.push(fs[i].contents + "," + pp);
}
var f = File(Folder.desktop + "/sku-log.csv");
f.encoding = "UTF-8";
f.open("w");
f.writeln(a.join("\n"));
f.close();
alert("Fin");
Run it on the open doc. Change the character style name to the one you want to target, leaving the quotes. It will save a sku-log.csv file out to your desktop.
Copy link to clipboard
Copied
This. Wow.
Thank you very much!
Truly above helpful.
Shawn
Find more inspiration, events, and resources on the new Adobe Community
Explore Now