Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all 15932 articles
Browse latest View live

Export PDF into multiple locations?

$
0
0

Lets say your working off your desktop and have an inDesign file named 1350.indd you also have two servers with a folder named 1350. Is it possible to export a pdf and have it save on the server, in the folders of the filename of the indesign document?

 

So it would go,

 

        Desktop - 1350.indd

Server 1            Server 2

1350 Folder      1350 Folder

1350.pdf            1350.pdf

 

Another layer which I don't think is possible but if it looks on the server and doesn't see a 1350 folder, could it create one and then save the pdf inside that?


AppleScript Corner Options

$
0
0

If you try to create a page item with rounded corner options (or any corner option), you will find there is a nasty bug with AppleScript. The compiler just will not let you set the corner option for the bottom right corner. There was an answer to this problem posted a few years back that used the raw (chevron) code to work around the bug. (See Mar 27, 2011 Applescript:Corner Options Am I mad or did I find a bug?)

My solution has been to create a default object style with rounded corners and then apply the object style whenever I needed rounded corners. I then override the corners that are not to be rounded, and set radius as needed.

Recently, however, I was putting a sample script together that would create a button that had just the top left and bottom right corners rounded. I found that the raw (chevron) code for bottom right corner option no longer worked (OS 10.9.5, InDesign CC 2014.1). You might want to try the following yourself:

tellapplication "Adobe InDesign CC 2014"

  setdocReftotheactive document

  telldocRef

  setrectReftomakerectanglewith properties {geometric bounds:{50, 50, 150, 150}, fill color:"Black"}

  tellrectRef

  setthetop left corner optiontorounded corner

  setthetop left corner radiusto 12

  setthetop right corner optiontonone

  setthebottom left corner optiontonone

  set the «property pcO4» to rounded corner --that is a capital O, not a zero

  setthebottom right corner radiusto 12

  endtell

  endtell

endtell

 

The compiler changes the line to (notice double space after "bottom"):

     set the bottom  right corner to rounded corner

and posts the following error:

     A property can't go after this property

 

To try to solve the problem, I removed the raw code from within the tell statement to InDesign.The script then begins with

set theProperty to «property pcO4»

tell application "Adobe InDesign CC 2014"

--then later, in the tell rectRef block

set theProperty to rounded corner

The code compiles, changing «property pcO4» to «class pcO4» and the corner does not round.

 

Of course, if all corners are to be rounded, you can create the rectangle and then convert it to a rounded rectangle shape:

tellapplication "Adobe InDesign CC 2014"

  setdocReftotheactive document

  telldocRef

  setrectReftomakerectanglewith properties {geometric bounds:{50, 50, 150, 150}, fill color:"Black", theProperty:rounded corner}

  tellrectRef

  convert shapegivenconvert to rounded rectanglecorner radius 12

  endtell

  endtell

endtell

CS6 scripts not support to the CC2014?

$
0
0

Hi All,

Some CS6 codes not supporting to the CC 2014. If any big variation about the "object module"?

 

If yes, how to find and handle this?

 

 

 

Selva.

Find Hide or Not Visible Elements

$
0
0

Hi All,

 

Could you please help for below:

1. to find the hide objects or not visible elements.

2. move this elements into separate layer name

 

Look at layer 2 --- rectangle box is not visible

Screen Shot 2015-05-18 at 8.17.52 AM.png

 

Thanks

Siraj

Script - Selecting next layer comp through Object Layer Visibility

$
0
0

Hi,

 

I use InDesign to set up storyboards that I made in Photoshop, using Layer Comps for every drawing. Usually, I save the one psd file and for a first-time set up, I place the same psd in all frames and then open Object Layer Options and choose the layer comp that I want to show.

 

However, I have a 122 frame storyboard due tomorrow. Instead of spending my evening clicking layer comps, I was wondering if there's a script that can select the next frame, and turn on the next layer comp, and so on. Or, alternatively, a script that counts the amount of layer comps in the file and creates the frames by itself, choosing a different layer comp to display for each new frame. Or any other solution that works. I'd like to keep using layer comps in the same psd file, so I only have to worry about changing the psd and updating the indesign file when changing frames (so I'd rather not export pdfs through Bridge and then add text in InDesign for example.).

 

I've googled a bit but haven't been able to find a script that did what I wanted. I hope someone can help me out.

 

Thanks in advance!

Generating output packages where selected images are contained in a specified outside directory

$
0
0

Over a period of time [sometimes over a few years!] I use the same PSD or AI file in different versions of client projects. After completing a project I will package [archive] the files. However, photo or graphic images used in an earlier document are often revised, so, older collected output packages contain older versions of the revised photos or graphics. When I'm asked to update an older file there are often current changes that are not reflected in the older files.

 

I have looked at creating files in File > New > Document, Book, Folio and Library. 'Book' seems the most likely prospect. However, my projects don't lend themselves to the File > New > Book ... since PSD or AI files are repurposed for print, large format, or Internet in a variety of size formats.

 

Ideally, I would like a simple alert that let's me know a file has been modified outside of the output package, or, a choice of saving -- or referring -- to selected PSD or AI files in a directory that isn't part of the output package, or, a way to replace all PSD or AI files within a selected group of output packages [this is problematic tho']. As I was reading through other discussions, there were references to Scripts which appear to allow more user control.


Indesign CC is very advanced. I'm painfully aware that I use only a small percentage of the available features. Any ideas are appreciated.


Steve

[AS][CS5] Find and replace a missing font

$
0
0

I have an overly complex script that compares the document's fonts missing fonts to the system fonts and makes a best guess. It was written to handle conversion of Multi-ad Creator documents to InDesign. It has worked 100% of the time so far. It needs a LOT of cleaning up and tweaking to make effecient, but that is not the point of my question. Everyday I am sent an InDesign file I have to work with and everyday it will has a missing font. Arial (OTF).

I ran my script thinking it would replace it with Arial (TT). No problem...

 

Ran it... nothing.

 

When I use the find dialog in Indesign to search based on the applied font it works, the returned properties in AS contain:

 

return properties of find text preferences

font:"Arial (OTF)"

 

Ok, fine so I try...

 

set properties of find change text options to {case sensitive:false, whole word:false, include footnotes:false, include hidden layers:false, include locked layers for find:true, include locked stories for find:true, include master pages:true}

    set applied font of find text preferences to "Arial (OTF)"

    set applied character style of change text preferences to "Page&Header"

    tell document 1

        set myFoundItems to change text

    end tell

 

Nothing.

 

This has pretty much worked on every other font I've tried, so what am I doing wrong here?

Updating Dave Saunders find style/change case script

$
0
0

How can I update a Dave Saunders script from CS1 and CS2 to CS5?

 

he wrote a brilliant script which searches for a paragraph style and changes the case to upper or lower.

 

However, it was for CS1 and CS2.   I can 't get it to run on CS5.

it trips up on

 

  app.findPreferences = null;
object does not support 'findPreferences'

 

here is the script.  thanks for your help!

 

//DESCRIPTION: Converts text in designated parastyle to designated case

 

if ((app.documents.length != 0) && (app.selection.length != 0)) {
myDoc = app.activeDocument;
myStyles = myDoc.paragraphStyles;
myStringList = myStyles.everyItem().name;
myCaseList = ["Uppercase","Lowercase", "Title case", "Sentence case"];
myCases = [ChangecaseMode.uppercase, ChangecaseMode.lowercase, ChangecaseMode.titlecase, ChangecaseMode.sentencecase];

 

var myDialog = app.dialogs.add({name:"Case Changer"})
with(myDialog){
  with(dialogColumns.add()){
   with (dialogRows.add()) {
    with (dialogColumns.add()) {
     staticTexts.add({staticLabel:"Paragraph Style:"});
    }
    with (dialogColumns.add()) {
     myStyle = dropdowns.add({stringList:myStringList,selectedIndex:0,minWidth:133});
    }
   }
   with (dialogRows.add()) {
    with (dialogColumns.add()) {
     staticTexts.add({staticLabel:"Change Case to:"});
    }
    with (dialogColumns.add()) {
     myCase = dropdowns.add({stringList:myCaseList,selectedIndex:0,minWidth:133});
    }
   }
  }
}
var myResult = myDialog.show();
if (myResult != true){
  // user clicked Cancel
  myDialog.destroy();
  errorExit();
}
  theStyle = myStyle.selectedIndex;
  theCase = myCase.selectedIndex;
  myDialog.destroy();

 

  app.findPreferences = null;
  app.changePreferences = null;
  myFinds = myDoc.search('',false,false,undefined,{appliedParagraphStyle:myStyles[theStyle]});
  myLim = myFinds.length;
  for (var j=0; myLim > j; j++) {
   myFinds[j].texts[0].changecase(myCases[theCase]);
  }

 

} else {
errorExit();
}

 

// +++++++ Functions Start Here +++++++++++++++++++++++

 

function errorExit(message) {
if (arguments.length > 0) {
  if (app.version != 3) { beep() } // CS2 includes beep() function.
  alert(message);
}
exit(); // CS exits with a beep; CS2 exits silently.
}


Any script to change stylesheet names AND language at once?

$
0
0

Here is the case:

In a document I have numerous stylesheets (probably more than 30, all have to be there, it's a very technical brochures with lots of different styles). As this was planned to be duplicated and used in another language, absolutely all stylesheets end with _EN (for English) and all are set to English as the language used for correct spelling and hyphenation. Now I am ready to go for the Spanish version and I would like to change all stylesheets at once to end with _SP (for Spanish) and be set to Spanish as the language to be used for spelling and hyphenation.

Any clue someone if this can be done with a JavaScript and if yes any ideal where to find such a script?

Thanks for any comment / help.

[ANN] Script Bay Update

Character/Paragraph Style Hilight colors

$
0
0

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.

 

enableStylePreviewModeboolr/wIf 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.

 

Screen Shot 2012-02-05 at 5.35.21 AM.png

automatic page numbering with AS

$
0
0

Hello All,

 

I'm pretty new in Applescripting but i've written a script to design a page in InDesign CS5 but now i'm trying to set the pagenumber in the same script.

I tried the following but didn't work out:

 

set mypagenumber to text returned of (display dialog¬

  "set pagenumber" with title "Paginanummer instellen" with icon 1 ¬

default answer "1" buttons {"instellen"} default button 1)

 

tell application "Adobe InDesign CS5"

  set start page number of active document to mypagenumber

end tell

 

i'll hope somebody can tell me what i'm doing wrong.

Thanks in advance,

 

Michael

Sorting Document Width and Open Files

$
0
0

Hi All,

 

Final Request:

My request is combine multiple files into one as per document width. (i.e., 20 files into 1)


Please help how to open the width sorted files again:

 

var  myFolder = Folder.selectDialog("Select the Folder contains Indesign Files");
var myFiles = myFolder.getFiles("*.indd");
myWidthArray = new Array();

for(i=0; i<myFiles.length; i++)
{    app.open(myFiles[i]);    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;        var myDocument_Width = app.activeDocument.documentPreferences.pageWidth;    alert("Doc_Name: " + app.activeDocument.name + "\rWidth: " + myDocument_Width);       myWidthArray.push(myDocument_Width)       app.activeDocument.close();    }

alert(myWidthArray)
var myPoints = myWidthArray;
myPoints.sort(function(a, b){return a-b});
alert("myPoints: " + myPoints)


//here need help
for(k=0; k<myPoints.length; k++)
{    app.open(myPoints[k])    }

 

 

Once I open the file again, then I integrate with the existing forum script

 

var destination_doc = app.activeDocument;
destination_doc.documentPreferences.allowPageShuffle = true; 
destination_doc.spreads[-1].allowPageShuffle = true; 



// select the source folder
var sourceFolder = Folder.selectDialog("Select a folder with source InDesign files.");

// if we're not in the source folder, stop running the script.
if ( !sourceFolder ) {
    exit(0);
}

// set file list and run through each file. Sorting them alphanumerically.
var fileList = sourceFolder.getFiles();
fileList.sort();

// run through each file
for ( var i = 0; i < fileList.length; i++ ) {    var source_file = fileList[i];    // making sure it's an indesign file...    if ( source_file instanceof File && source_file.name.match(/\.indd$/i)) {        app.open(source_file);        var source_doc = app.documents.item(source_file.name);        var sourcePages = source_doc.pages.item(0);        // break the master page items so they can be moved onto the new document.        var masterItems = sourcePages.masterPageItems;        if ( masterItems.length > 0 ) {            for ( var j=0; j<masterItems.length; j++ ) {                masterItems[j].override(sourcePages);            }        }        // removing the applied master (this can mess up some files if not done)        sourcePages.appliedMaster=null;        // duplicating it in the original file (due to errors) and them moving it to        // the destination document.        sourcePages.duplicate(LocationOptions.AFTER, source_doc.pages.item(0));        sourcePages.move(LocationOptions.AFTER, destination_doc.pages.item(-1));        // closes the file that was opened without saving (to avoid memory problems)        app.activeDocument.close(SaveOptions.NO);    }
}

 

Appreciate, any other better way.

 

Thanks in advance

Siraj

How do you use JS to open a Folder dialog

$
0
0

If you use this to open a dialog box to select a file:

     File.openDialog("Select your XML File", "*.xml")

 

The how do you open a dialog to select a folder.  I would think it would be something like

     Folder.openDialog

 

but alas, it is not, and I cannot find any reference on how to do it anywhere.  Does any one know?

 

Thanks

Convert an image file to Base64 or other string value

$
0
0

Hi,

I need toread the contentof an image file(JPEG, PNG,TIFF) andconvert that file toBase64string.

Does anyone know ifyou cando these thingson Javascript, in InDesign?

Thanks forany help

EDIT: I forgot toadd thatI knowmy imagepath onthe filesystem,itresidesinsideof my filesystem. I obtain that path thanks to InDesign...


WaxRun

$
0
0

Hello,

 

In the SDK you can access a WaxRun, here is how the documentation describes a waxrun.

"

wax run is created each time the appearance of the text changes within the line. Examples of this include changes in point size, changes in font, and the interruption of the flow of text in a line because text wrap causes text to flow around another frame. "


A textStyleRange doesn't quit do it.


Any way to get this via scripting?


Thank you.


P.

 

How to control the output size when exporting images from an InDesign Document?

$
0
0

I have a script that loop through the document images and write them to the disk, but I would like to know how to control the output size of the images. Right now images seems to be exported the same size as their source, but with the exception where smaller images are getting up-scaled.


var doc = app.activeDocument;
var images = doc.allGraphics; 
var documentPath = doc.filePath;

app.jpegExportPreferences.jpegColorSpace = JpegColorSpaceEnum.RGB;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;
app.jpegExportPreferences.exportResolution = 300;

for(var i=0; i < images.length; i++){  filename = documentPath + "/image_" + (i+1) + ".jpg";  var imageFile = new File(filename);  images[i].exportFile(ExportFormat.JPG, imageFile, false);
}

 

The same question was asked on stackoverflow, but I was told it was not possible, is this true?

extendscript - How to control the output size when exporting images from an InDesign Document? - Stack Overflow

Preserve Local Formatting script and CS4

$
0
0

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

Change Web Content URL

$
0
0

Hi!

I have a document plenty of Object States. Each one have a rectangle with a web content overlay.

How can I change the web content URL? I've been serching this for days without find anything...

In other words, I want to check an InDesign file with an overlay and check what boxes are linked as web content and change their URL.

 

Thanks

save and add metadata

$
0
0

Hi,

We often have to print docs on different types of paper and I was wondering if a script existed (or could be made) which lets us enter the filename (so we can save it somewhere) and which opens the file Info panel so we can enter the paper type (in the description area below the author Title) or just asks for the type of paper and puts the answer into the description area of the file info. That way, we can always find the right paper type again. I found some discussion about how to automate it, but that's not what I need.
thanks

Viewing all 15932 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>