Forum Replies Created
-
AuthorPosts
-
Peter KahrelParticipantStill doesn’t look right. But you can copy the script text anyway.
P.
Peter KahrelParticipant(Sorry, got the coding tags wrong.)
(function(){function exportDocumentStories (doc) {
var stories = doc.stories.everyItem().getElements();
var baseName = String(doc.fullName).replace(/\.indd$/,’ ‘);
for (var i = stories.length-1; i >= 0; i–) {
if (stories[i].textContainers[0].parent instanceof Spread) {
f = File (baseName + stories[i].id + ‘.icml’);
stories[i].exportFile (ExportFormat.INCOPY_MARKUP, f);
}
}
}function exportICML() {
var chapters = app.activeBook.bookContents.everyItem().getElements();
for (var i = 0; i < chapters.length; i++){
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
app.open (chapters[i].fullName);
exportDocumentStories (app.documents[0]);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
}if (app.books.length === 1) {
exportICML();
} else {
alert (‘Open (just) one book.’);
}}());
Peter KahrelParticipantHere’s a script that exports all stories on document pages (i.e. skipping stories on master spreads). It saves the icml files in the documents folders using the document name followed by a number (the numbers look random but are the storyies’ IDs). (Adding functionality to select a book and an output folder is a hassle.)
Peter
[CODE]
(function(){function exportDocumentStories (doc) {
var stories = doc.stories.everyItem().getElements();
var baseName = String(doc.fullName).replace(/\.indd$/,’ ‘);
for (var i = stories.length-1; i >= 0; i–) {
if (stories[i].textContainers[0].parent instanceof Spread) {
f = File (baseName + stories[i].id + ‘.icml’);
stories[i].exportFile (ExportFormat.INCOPY_MARKUP, f);
}
}
}function exportICML() {
var chapters = app.activeBook.bookContents.everyItem().getElements();
for (var i = 0; i < chapters.length; i++){
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
app.open (chapters[i].fullName);
exportDocumentStories (app.documents[0]);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
}if (app.books.length === 1) {
exportICML();
} else {
alert (‘Open (just) one book.’);
}}());
[CODE]
Peter KahrelParticipantUgo,
Makes perfect sense, but your index is possible only through scripting, InDesign wouldn’t be able to create your index on its own. You’d have to commission someone to write it for you.
Peter
September 5, 2015 at 6:40 am in reply to: GREP incorrectly shifting italics over in found text #77900
Peter KahrelParticipant(subscribing)
Peter KahrelParticipantEPS export can be applied only to InDesign pages. The only way to export images as EPS is to place each image on a page, clip the page to the size of the image, then export that page.
Peter
September 5, 2015 at 6:32 am in reply to: GREP incorrectly shifting italics over in found text #77898
Peter KahrelParticipantMatt,
InDesign formatting points to text ranges. When you change the text using Text or Grep changes, the text is changed but the format pointers aren’t updated. In your case you can get around this problem as follows:
1. Find what: ^\[FIGURE \d+:+
Change to:
Change format: the caption paragraph style2. Find what: \]$
Find format: the caption style
Change to: <nothing>
Change format: <nothing>Note that the italics have to be in a character style because applying a paragraph style using find/change nukes local formatting.
Peter
September 5, 2015 at 6:09 am in reply to: Help: Script to find by label not working with quotes #77896
Peter KahrelParticipantOut of context this doesn’t make much sense. What did the label look like before you added the quotes? And what exactly do you want to achieve?
September 5, 2015 at 6:08 am in reply to: Help: Script to find by label not working with quotes #77895
Peter KahrelParticipantOut of context this doesn’t make much sense. What did the label look like before you added the quotes? And what exactly do you want to achieve?
Peter KahrelParticipantInDesign’s formatting points to positions in the text. If you change the contents of the text, the format pointers don’t change. As a result, the text appears messed up. The way to deal with this is to change the formatting with some text tags, remove the formatting, apply your changes, and remove the tags.
Manually this would work as follows:
1. Find: (.+)
Find format: cyan
Change to: _c_$1_c_
Change format: Black swatch2. Do the replacement that you had in your query.
3. Find: _c_.+?_c_
Find format: <nothing>
Change to: <nothing>
Change format: cyan swatchDo the above steps for magenta and yellow, using the tags _m_ and _y_, respectively.
Finally, remove the tags:
Find: _[cmy]_
Change to: <nothing>
And clear the two format fields.All this is captured by the script below.
Peter
//—————————————————————————————
app.findGrepPreferences = app.changeGrepPreferences = null;
changeColour (‘(.+)’, ‘_c_$1_c_’, ‘cyan’, ‘Black’);
changeColour (‘(.+)’, ‘_m_$1_m_’, ‘magenta’, ‘Black’);
changeColour (‘(.+)’, ‘_y_$1_y_’, ‘yellow’, ‘Black’);app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = ‘t(w+)t(w+)t(w+)t(w+)’;
app.changeGrepPreferences.changeTo = ‘t$1t$3t$2t$4’;
app.documents[0].changeGrep();app.findGrepPreferences = app.changeGrepPreferences = null;
changeColour (‘_c_.+?_c_’, ”, ”, ‘cyan’);
changeColour (‘_m_.+?_m_’, ”, ”, ‘magenta’);
changeColour (‘_y_.+?_y_’, ”, ”, ‘yellow’);app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = ‘_[cmy]_’;
app.changeGrepPreferences.changeTo = ”;
app.documents[0].changeGrep();function changeColour (f, r, c1, c2) {
app.findGrepPreferences.findWhat = f;
app.changeGrepPreferences.changeTo = r;
app.findGrepPreferences.fillColor = c1;
app.changeGrepPreferences.fillColor = c2;
app.documents[0].changeGrep();
}//—————————————————————————————
-
AuthorPosts
