How to add bookmark for selected paragraphs
Bookmark
Cycling through paragraph styles script - Help Needed
Hi
I have a large document (potentially 3000 pages), on each page is a graphic of a picture frame and inside each frame is a famous quotation. I need to have the type in each quotation set in a different font so i've setup 10 different paragraph styles. I need a script that will apply 'QuoteStyle1' to the text on the first page, 'QuoteStyle2' to the next page etc, and once 'QuoteStyle10' has been applied the script loops and continues to cycle through the styles applying a different style on each page until it reaches the end of the document.
I've made a start on the script (see attached image) but I think the problem is line 11 - I want to run the script without having to select anything.
Some further info that may or may not be of use - All of the quotes are being pulled in from a data-merge. There's also a name and a colour coming from the data-merge. The background on each picture frame is a different colour and that is created with the a very large 'Rule Below' in a number of other paragraph styles. These are being applied with a 'Find&ReplacebyList' i.e. find 'Red' replace with paragraph style 'ColourRed'. In the script i've tried to skip these 'Colour' paragraph styles (lines 2-9) so it's only the 'Quote' styles that the script effects.
Script for add images to indesign page by page.
Hello,
I have 200 pages with border in indesign and 200 images having in local folder. every image name is S1, S2, S3...etc. Need script to add S1 to indesign page1 with centre in the border.
Same for S2, S3..like that.
Please suggest any script for that.
Regards,
Sampath.S
Script info
Hi, all.
Is there any possibility to display some information to user (e.g. number of pages processed) in status bar or something like that? MsgBox doesn't help, because it interrupts execution of the script. (vba only)
With CS3, some things have changed
Indesign: Export multiple groups as .eps
I have a product catalogue that I've created in InDesign and now I need to update the website with the new product images. The product images are linked .eps files that have dimensions added to them using lines and text boxes for the numbers. This is all then grouped together and there are a couple hundred of these all up.
The question is, is there a script that will export each individual group as an .eps file? So then I don't have to do it manually which would be a mammoth task.
Any ideas would be appreciated!
Adam
Preserve Local Formatting script and CS4
Unfortunately, Dave Saunders' amazing PreserveLocalFormatting.jsx script (that changes local formatting to character styles) doesn't work under InDesign CS4. I've tried running it both as-is and in the compatibility mode (putting it in a folder marked Version 4.0 scripts), and it seems to star to run, but doesn't actually do anything. Anyone more versed in scripts know what might be the trouble?
http://indesignsecrets.com/downloads/PreserveLocalFormatting.jsx
InDesign Scripting Question
Is it possible to create a script that will do the following?
Create an InDesign script that will automatically generate a .pdf with the following parameters once run:
1) Print Quality
2) Watermark – DRAFT, at diagonal, fills most of the page, 50% or lighter
3) Secured/Flattened so no changes can be made in Acrobat Pro – so the watermark and any content cannot be edited
4) Uses current InDesign filename, but with .pdf extension
5) Saves in same folder as current InDesign file
If so, any advice on where to start?
measure real page size for every page in listbox
hi guys,
I'm trying to write a script which will list all pages in listbox with 2 additional columns: width and height
and stuck when trying to get pages bounds for every page in document.
My result now looks like that:
script whatever I'm trying to do getting only size of 1st page and populate it to every item.
My code to get page size as above is:
myDoc=app.activeDocument;
var page = myDoc.pages[0];
...
function myRealHeight(){
var Pbound = page.bounds;
var pH = Pbound[2] - Pbound[0];
var realHeight = [];
for(j= 0; j< myDoc.pages.length; j ++){
realHeight.push(pH);
}
return realHeight;
}
i tryied some different ways but but always returned [Object Page] or above.
I'm newbie in scripting and if someone could help me will be great.
thanks
(let me know if some other parts of code are necessary)
how to use evaluateXpathexpression through vbs?
hii
i want to know how to use EvaluateXpathExpression through vbscript or vb.net?
How to get loop through the elements and get all the elements with the same name?
Please help
Thanks
Finally! A progress bar for AppleScripters!
Progress bars are something that my scripts have lacked as I mainly program in AppleScript. I had resorted to using an outside app as a progress bar in my scripts...
But no more!! I have borrowed Marc Autret's Javascript progress bar code from
and made it into some handy handlers. I hope this helps other people too.Here they are in an example AppleScript.
on myProgressBarCreate(pbBarName, firstAction, pbMax) set pbJS to "#targetengine 'pbar' var ProgressBar = function(/*str*/title) { var w = new Window('palette', ' '+title, {x:0, y:0, width:340, height:60}), pb = w.add('progressbar', {x:20, y:12, width:300, height:12}, 0, 100), st = w.add('statictext', {x:10, y:36, width:320, height:20}, ''); st.justify = 'center'; w.center(); this.reset = function(msg,maxValue) { st.text = msg; pb.value = 0; pb.maxvalue = maxValue||0; pb.visible = !!maxValue; w.show(); }; this.hit = function() {++pb.value;}; this.hide = function() {w.hide();}; this.close = function() {w.close();}; }; pBar = new ProgressBar('" & pbBarName & "'); pBar.reset('" & firstAction & "', " &a pbMax & ");" tell application "Adobe InDesign CS5" activate do script pbJS language javascript end tell end myProgressBarCreate on myProgressBarIncrement() set pbJS to "#targetengine 'pbar' pBar.hit()" tell application "Adobe InDesign CS5" to do script pbJS language javascript end myProgressBarIncrement on myProgressBarReset(newAction, newMax) set pbJS to "#targetengine 'pbar' pBar.reset('" & newAction & "', " & newMax & ");" tell application "Adobe InDesign CS5" to do script pbJS language javascript end myProgressBarReset on myProgressBarClose() set pbJS to "#targetengine 'pbar' pBar.close();" tell application "Adobe InDesign CS5" to do script pbJS language javascript end myProgressBarClose tell application "Adobe InDesign CS5" activate my myProgressBarCreate("Test", "PDFing...", 10) repeat 10 times my myProgressBarIncrement() delay 0.25 end epeat my myProgressBarReset("Creating pages...", 5) repeat 5 times my myProgressBarIncrement() delay 0.5 end repeat my myProgressBarClose() end tell
Background Export Cancelled - Event? (JS)
I'm having trouble figuring out how to capture when a user cancels a background export task (from the background tasks panel). ImportExportTask.FAILED_EXPORT doesn't appear to work as described by the documentation, regardless if I listen on the app or the document being exported.
I've also tried using Idletasks which wait for changes in status to the BackgroundTask, but it seems really dirty, and IdleEvent.ON_IDLE events don't trigger reliably enough for my purposes (based on my own experience).
Ideally I'd like to capture the completion of asynchronous export events (success, failure, or cancellation) as soon as they happen, so that I can close the associated documents (which my script has generated and remain open in the background during the export process) and let the user get on with their day. Success events are no problem, it's the others I'm having trouble with.
I'd really appreciate it if anyone could help me with this, I've been spinning my wheels on this one for far too long.
Thanks!
PS: I am using JS, and Indesign CC 2014
Script to Export INDD file as PDF, named to match containing folder, not original file name
All - I am trying to create a script to open an INDD file and export to PDF, not as the file name but as the name of the folder containing the PDF. Any ideas?
Find format preferences in a Find/Change GREP script?
Hi all,
I'm creating my first Find/Change script to handle several GREP queries at once. But I'm struggling to work out how to specify the Find Format: preference in the script as one can in the usual Find/Change dialog box.
Here's a sample line in my script. What I'm trying to achieve is for this line to search for characters/words that currently have the [Basic Paragraph] applied to it, and then change the format to a particular paragraph style, which I've called "Team name" ...
grep {findWhat:"(.+)", appliedParagraphStyle:"[Basic Paragraph]"} {changeTo:"$1", appliedParagraphStyle:"Team name"} {} // apply Team name style
Btw, I'm using the standard FindChangeByList script that comes with Indesign. All help/feedback is appreciated.
Cheers,
Marco
[JS CS3 WIN] ExportEachPageAsPDF
Hello,
I have found this script. Now I want to modify the filename section.
//ExportEachPageAsPDF.js
//Exports each page of an InDesign CS document as a separate PDF to
//a selected folder using the selected PDF export settings.
//Display a "choose folder" dialog box.
if(app.documents.length != 0){
var myFolder = Folder.selectDialog ("Choose a Folder");
if(myFolder != null){
myExportPages(myFolder);
}
}
else{
alert("Please open a document and try again.");
}
function myExportPages(myFolder){
var myPageName, myFilePath, myFile;
var myDocument = app.activeDocument;
var myDocumentName = myDocument.name;
var myPDFPresets = app.pdfExportPresets;
var myPDFPresetNames = new Array;
for (i = 0; i < myPDFPresets.length; i++)
myPDFPresetNames.push(myPDFPresets[i].name);
var myDialog = app.dialogs.add();
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()) {
staticTexts.add({staticLabel:"Base name:", minWidth:130});
}
with(dialogColumns.add()) {
var myBaseNameField = textEditboxes.add({editContents:myDocumentName, minWidth:160});
}
}
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"PDF preset: ", minWidth:130});
}
with(dialogColumns.add()){
var myPDFPresetsDropdown = dropdowns.add({stringList:myPDFPresetNames, selectedIndex:0});
}
}
}
var myResult = myDialog.show({name:"ExportPages"});
if(myResult == true){
var myBaseName = myBaseNameField.editContents;
var myPDFPresetName = myPDFPresetNames[myPDFPresetsDropdown.selectedIndex];
//Remove the dialog box from memory.
myDialog.destroy();
for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
myPageName = myDocument.pages.item(myCounter).name;
app.pdfExportPreferences.pageRange = myPageName;
//Generate a filename. /////////////////////////////
app.findTextPreferences.appliedParagraphStyle = "picture_description";
app.findTextPreferences.findWhat = '';
myStory = myDocument.stories;
myFound = myStory.findText();
// alert(myFinds[0].contents);
myFilePath = myFolder + "/" + myFound[0].contents + ".pdf";
myFile = new File(myFilePath);
myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFPresets.item(myPDFPresetName));
///////////////////////
}
}
else{
myDialog.destroy();
}
}
On every page there is only 1 paragraph styled with the paragraphstyle "picture_description".
I want to use the content of this paragraph for the filename for each page.
please, can someone help me?
Best regards
Christoph
how to use evaluateXpathexpression without using any namespace?
hello
Can anyone please tell me how to use evaluatexpathexpression without using any namespace and adding the child elements to root element?
Is there any way?
Please help
Thanks
Character/Paragraph Style Hilight colors
In May 2010 Marc Autret posted this interesting blog: Show Local Formatting in InDesign CS4/CS5, where he shows how an undocumented feature of InDesign can be put to good use. If you set TextPreference.enableStylePreviewMode to true, ID suddenly shows red lines marking local character and paragraph style overrides. A very neat find, one that I use all the time to check my documents for (uh) "neatness".
I just ran across this obscure scripting preference whilst looking for something entirely unrelated -- but something in the description caught my eye.
enableStylePreviewMode | bool | r/w | If true, highlights character and paragraph styles with colored backgrounds. |
Regular lurkers might remember the puzzling "previewColor" properties in Paragraph and Character Style. Now that's what this is for!
This script will add background colors to a paragraph style and a character style, and then show them in your document. No need to worry about your document, despite the name they only appear in Normal view. In Preview mode they disappear, and they will not print or export to PDF.
app.activeDocument.textPreferences.enableStylePreviewMode = true; app.activeDocument.paragraphStyles.item("Body Text").previewColor = UIColors.YELLOW; app.activeDocument.characterStyles.item("Italics").previewColor = UIColors.CYAN;
Upside or downside is this comes with those override red line markings for free. Oh well. Perhaps it's a preference in CS6 -- and I wouldn't mind if the preview color could be set in the style options either, for now it needs a script.
Sellect TOC with script
I've been trying not to asked a question every step of the way but, I'm no good at this.
I am now trying to select the TOC with script so I can use other scripts (idea being able to do a set of actions to 3 different items with 1 click). I think I am looking for something like this:
app.select( app.activeDocument.pageItems.item("preface") );
From what I read, that stopped being good in CS5 and now I need to loop through the whole thing to find something that I name in the script lable area. I can't find any examples of a current good example of this. Any help would make me smile.
Here is what I got so far:
/* REFRESH TOC WITH NEW CHAPTER STUFF */
/*app.select( app.activeDocument.pageItems.item("preface") ); */
app.scriptMenuActions.itemByID(71442).invoke(); //Update TOC
/* UPDATE STYLING OF TOC AFTER REFRESH */
app.findChangeGrepOptions.includeLockedLayersForFind = true;
app.findChangeGrepOptions.includeLockedStoriesForFind = true;
app.findChangeGrepOptions.includeHiddenLayers = true;
app.findChangeGrepOptions.includeMasterPages = true;
app.findChangeGrepOptions.includeFootnotes = true;
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\^n\\^yPage";
app.changeGrepPreferences.changeTo = "\\n~yPage";
app.activeDocument.changeGrep();
Thanks again.
Dynamically populate InDesign file and publish
Greetings,
I have a database full of text and I would like to publish the data into a nicely designed InDesign file. I can easily dump the data into XML, JSON, or raw Text but is it possible to dynamically populate an InDesign file with this data then publish straight to PDF? Are there any examples of dyanmic data being published from an external source (like XML, JSON, etc.)?
[ID8+/JS] Context Menu Item for Paragraph and Character Style Palette
Hello,
I'm looking for a way to add custom scripts to the context menus (right click with the mouse) of the paragraph style and the character style palette.
So the user finds the style he's looking for, right clicks on it, chooses my script, the script gets the reference to the selected style item, and runs with it.
Is this possible by scripting? A forum and google search was unsuccessful.
Thanks!
Tobias