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

save pdf when saving indd

$
0
0

Hey Everyone.  I spend a lot of my day making merged document and then saving the merged indd file for changes after the files are reviewed.  I merge the doc, save the indd file and then save a pdf using a preset with the same name to send for review.

 

Is there a script out there that I could run, give the file name and have it then save the an indd file and then a pdf using my preset to a folder?


script for running multiple find/change queries

$
0
0

Working on a large ID book document (*.indb), I have saved several dozens of Find/Change Queries (named "col01", "col02" etc.) that I run on "All documents". For a particular reason I have to run these queries several times a day.

 

So I was wondering whether there is, or whether anybody out there would write, a script that runs these queries one after the other. Given the size of the book, it might be necessary to provide for the script to pause after each query is run (before it goes on with the next), but I am just guessing.

 

Any help is much appreciated!

Script to get the image height and width

$
0
0

I need to know the size (dimensions) of images placed in an InDesign 5.5 document.

 

I have made the following script by combining different code. It gets the metadata OK, but the witdh and height are empty. Am I using getProperty wrong?

 

// Refr
// https://forums.adobe.com/thread/288764
// https://forums.adobe.com/thread/2288546          var scriptName = "Get description from selected link",      doc;            PreCheck();        //exif:PixelXDimension   tiff:ImageWidth    //===================================== FUNCTIONS ======================================      function Main(image) {          var link = image.itemLink,          metadata = link.linkXmp,           description = metadata.description,        format = metadata.format,        author = metadata.author,        modificationDate= metadata.modificationDate,        creator = metadata.creator,        myLinkWidth = metadata.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageWidth"),        myLinkLength = metadata.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageLength"),         Width = metadata.getProperty("http://ns.adobe.com/exif/1.0/", "exif:PixelXDimension"),        Height = metadata.getProperty("http://ns.adobe.com/exif/1.0/", "exif:PixelYDimension");        alert("Description is: '" + description + "'\nFormat: " + format + "\nAuthor: " + author + "\nDate modified: " + modificationDate + "\nCreator: " + creator, scriptName, false);         alert("Pixel dimentions of image:\nWidth: " + myLinkWidth + Width + " pixels\nHeight: " + myLinkLength + Height +" pixels");    }      //--------------------------------------------------------------------------------------------------------------------------------------------------------      function PreCheck() {          var image;          if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);          doc = app.activeDocument;          if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);          if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);          if (app.selection.length == 0 || app.selection.length > 1) ErrorExit("One image should be selected.", true);                    if (app.selection[0].constructor.name == "Image") { // image selected with white arrow              image = app.selection[0];          }          else if (app.selection[0].images.length > 0) { // container selected with black arrow              image = app.selection[0].images[0];          }          else {              ErrorExit("No image in the selection.", true);          }                Main(image);      }      //--------------------------------------------------------------------------------------------------------------------------------------------------------      function ErrorExit(error, icon) {          alert(error, scriptName, icon);          exit();      }      //--------------------------------------------------------------------------------------------------------------------------------------------------------  

 

I'll explain why I'm doing this:

I'm making a magazine and the photos we get are in all different sizes and quality. In a layer called "picName" I have text frames on top of images with information from Text Variables such as name of file, PPI, actual PPI, dimensions, and scale. I make a pdf of the magazine and while my editor proof reads and edits the document I fix the photos (I cannot use InDesign at same time as she.). I use the information from the picName-layer and an Excel-sheet to determine the right size of the images, and then I edit the images in Photshop.

 

It would be a lot easier to have the calculation in the pdf itself. What I hope to achive is:

 

  1. Get the width (W) of the linked image.
  2. Get the PPI (P) of the linked image.
  3. Get the scale (S) of the image in the frame (percent).
  4. Calculate the width the image should have: W * S * 300 / P
  5. Insert the width the image should have in a text frame in the picName-layer on top of the image.

Collect paragraph overrides and store it in XMl file

$
0
0

Hi Experts,

 

Is there any way to collect what are the things are manually altered (override) for all the paragraphs in all stories of a doc? And I would like to export the details with my XML as a comment or an processing instruction.

 

Thanks

pr

Counter Find Replace Text with alert

$
0
0

Hello!

 

This code replace all text human, and added a Column Break before the human text.

If the text was replace more than want time, I want show an Alert.

My problem with this code is the Column Break is added 2 times, because looks the function is called 2 times and not 1.

 

Please, how can I do for show the Alert but don't add 2 Column Break each time the script find the text?

 

app.findTextPreferences = NothingEnum.nothing;  
app.changeTextPreferences = NothingEnum.nothing;    
app.findTextPreferences.findWhat = "human\r";  
app.changeTextPreferences.changeTo = "^M\human\r";    
//this will show changes count 
var counter = app.activeDocument.changeText().length;    if(counter>1){        alert("BECAREFULL! The text was replace "+ counter + " times");    }
app.activeDocument.changeText();

 

 

Thanks so much in advance.

Placing Index Markers Based on Character Style

$
0
0
I have this simple script in IDCS2 that places index markers based of character style:

myDocument = app.activeDocument;
app.findPreferences = NothingEnum.nothing;
app.changePreferences = NothingEnum.nothing;

if (myDocument.indexes.length == 0) myDocument.indexes.add();

var index = myDocument.indexes[0];

var finds = myDocument.search(undefined, undefined, undefined, undefined, {appliedCharacterStyle: "IndexHolder"});

for (var i=finds.length-1; i>=0; i--) {
var found = finds[i];
var myTopic = index.topics.add(found.contents);
myTopic.pageReferences.add(finds[i], PageReferenceType.currentPage);
}

But after running the script some markers are placed off with respect to the search term... why is this happening?

For example, my term is Beijing, some of the markers are placed after the term:

Beijing some text some ^more text (marker is placed in the ^ character and not at the start of the word Beijing).

Hope someone can give me information on why this is happening and how to resolve this. Thanks!

-- Jeff

Sort algorithm: how can I sort two arrays according to one

$
0
0

I have two parallel arrays, similar to this:

 

var array1 = [4, 3, 1, 5, 2];

var array2 = ["four", "three", "one", "five", "two"];

 

I want to sort the first array, and have the second array follow the same sort as the first. Any advice for a good algorithm would be appreciated.

 

Rick Quatro

Simile Division

$
0
0

Hello, I am trying to build a calculation from one cell to another. This form is for an Army leadership school, it has 5 graded areas for 21 subjects, for 105 different individual scores. I have to simple math done and it adds up to a single block that can total 525 points. From this block, I want it to take their score and divide it by 525 and place into a GPA score, i.e. 493/525 = 93.9. What is the script for that one cell to make this style of GPA score?

 

Michael Davis


How to Re-Sign an Old CS5.5 Extension

$
0
0

We have a large customer for whom we wrote a CS5.5 InDesign Extension about 5 years ago. 2 years ago we re-built and signed the Extension. The code signing cert was only good for 2 years. 2 years have passed and we no longer have the old Extension Builder available or anyone who would  know what to do with it ...

 

I thought I could take the old ZXP file, unzip it, remove the META-INF dir (and the signature.xml file in it), and then resign it with ZXPSignCmd and a new cert.

 

I thought wrong.

 

The Adobe Extension Manager reports that the signature is not valid.

 

I would appreciate any help.

 

TIA,

mlavie

[JS] Override Alle Master Page Items

$
0
0

Hi all,

I'm trying to override all masterpage items from my script ...

function OverrideMasterItems(CurrentPage) {     document.pages[CurrentPage].appliedMaster.pageItems.everyItem().override(document.pages[CurrentPage]);
}

but I get "Invalid object for this request".

 

Any hints?

 

 

--

molsted

Finder Colour Tags

$
0
0

Hi,

I wondered if anyone can help, I'm trying to find how to alert the colour tags on a file from finder I.e. Green, Red etc.

I have put a "Test.indd" file on my desktop and tagged it Green to test this.

I have tried looking for this on the forum but can't find a Javascript version that I have been able to adapt, not sure if I'm going the right way but this is what I have at the moment.

 

alert(app.extractLabel ("~/Desktop/Test.indd"))

 

Many Thanks for any help, Bren

How to re-sign a CS5.5 or CS6 extension?

$
0
0

Hi.

 

I have a ZXP file with a flash extension developed for CS5.5. The certificate that was originally used to sign it has expired, and I'd like to re-sign it with a fresh certificate. I'd rather not have to attempt to install a legacy flash tool and re-build using that, so if there is a way forward with just re-signing the ZXP file, that would be easiest. 

 

I'm on a Mac, and I have ZXPSignCmd installed. My initial attempts seemed successful (ZXPSignCmd -verify is happy), but installing through the extension manager fails.

 

Thanks,

/Martin

Script to Export Multiple PDFs at Once

$
0
0

Hi All

 

I’m trying to find out how to export two PDF's at once from Indesign CC. I'm aiming to get 1 PDFx-1a PDF (High res with crop and bleed) and 1 smallest File Size (Cropped, no marks)? Could you point me in the right direction or if anyone has a working script I could use that would be amazing. My brain is going to fall out my ears.

 

Many thanks

 

Rahul

Script to move all objects to pasteboard

$
0
0

Hi friends,

 

Was wondering if anyone could help me out. In our publications, we have content automatically generated and placed page by page throughout the InDesign file and was wondering if there was a way to write a script to automatically move all content onto the pasteboard (left or right side, depending on which side of the spread the content is on).  I'm very new to the scripting world and don't have much of a background in it at all, but what we've been using is the following script that I pieced together (it may not even be the most efficient way to accomplish this):

 

var myObj = new Array;
myObj = app.selection;
app.activeWindow.activeSpread.groups.add(myObj);
app.activeWindow.activeSpread.groups.item(0).select();
var s =app.activeDocument.selection[0];    
s.move([-8,-.25])    s.ungroup();  

 

Users just select all on the left side of the spread, run the script and it moves everything off the pasteboard. We have a similar one for the right side too. Is there a way to automate this so users don't have to go page by page running this to move everything onto the pasteboard

 

Thank you for your patience!

Run .bat file with arguments?

$
0
0

Hi,

 

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

 

var myFile=new File("c:\\test.bat");

myFile.execute();

 

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.


Set blend mode and opacity of InDesign CC layer with AppleScript

$
0
0

I really need to set specific opacity and blend mode when creating a new layer in InDesign with my applescript but i just can't figure this one out.

 

This line gives me a new layer without problems.

 

makenewlayeratbeginningofdocument 1 with properties {name:StatusLayer}


i have tried to add the specs in the same line like this.


makenewlayeratbeginningofdocument 1 with properties {name:StatusLayer, blending settings:{blend mode:multiply, opacity:50}}


But i'll get my new layer with the default settings.


If i try this


makenewlayeratbeginningofdocument 1 with properties {name:StatusLayer}

settheopacityofblending settingsoftransparency settingsoflayerStatusLayerofdocument 1 to 50

settheblend modeofblending settingsoftransparency settingsoflayerStatusLayerofdocument 1 tomultiply


i will get this error message

Can not set opacity of blending settings of transparency settings of layer "Statuslager" of document 1 som 50.

 

How should the command for setting the Opacity and blend mode for a layer look to work properly, i'm stuck and have tried for hours!

Defining page range for PDF export

$
0
0

Hello,

I am trying to automate a PDF export process, where a single indesign file has to be exported as multiple PDFs into a specifically named folder structure. I have placed the information that the script needs on a non-printing layer on the first page of each PDF (The filename for the PDF and the foldername to put it in). My script successfully stores this information, along with the page number on which it was found.

 

The problem is that the indesign documents are divided into several sections and alternate layouts; when my script loops through the pages to harvest the information it stores the pages by their position in a zero-based array, not by their actual page numbers. It seems that it is the actual page numbers that are needed to define the page range for export. As the page numbers are repeated across the alternate layouts, I'm guessing would need to specify I section and a page number.

 

I can get the number of the page with pages[i].name, but how do I get the section number and put these two together in my page range definition?

 

BTW, all the PDFs are continuous page ranges, although sometimes they bridge section breaks.

 

Many thanks for any help.

Support needed to get Adobe to start looking into the scriptUI problem.

$
0
0

Hi everyone,

i've actually written to Adobe to feedback about the ScriptUI problem that some of us faced regarding unable to change the styles, Typeface and iconbutton alignment problem in CC.Below is the reply i got from Adobe Customer Care.

If this problem also affects you or colleauges/friends in a way or so. .please help to vote for it in order to get them to start to do something about it.

Thank you!

image.png


Reply from Adobe Customer Care:

This issue has already been notified to the product development team by some developers but we don’t have any update on the bug yet. I would also like to add here that this change is as per the new product design andwe don’t expect it to change soon. That said,the chances of getting this bug actioned is also quite less.

If you have other users who are also facing this problem and would like Adobe to work on this request, please ask them to visit the link below and vote for the bug.

https://indesign.uservoice.com/forums/601180-adobe-indesign-bugs/suggestions/32191990-unab le-to-change-font-size-style-in-script-ui-a

Folder.getFiles Multiple Filters Mask

$
0
0

Hi all,

 

Folder.getFiles (".*") ... in this case it will get all types of files

 

Folder.getFiles (".jpg") ... in this case it will get all files with .jpg extension

 

... but how can I filter to get (for example) all files with ".jpg", " .tif" or ".eps" extension ?

 

ESTK help says: A mask string can also be the name of a function that takes a File or Folder object as its argument. It is called for each file or folder found in the search; if it returns true, the object is added to the return array.

 

Any idea of how to make such a function?

 

I will appreciate any help.

List of all scripts labels

$
0
0

Hi everyone,

 

Is it possible to have the list of all labels associated to a textframe ?

Example :

     txtfrm.insertLabel "key1", "value1"

     txtfrm.insertLabel "key2", "value2"

     txtfrm.insertLabel "key3", "value3"

 

     txtfrm.getAllLabels  --> "key1, key2, key3"

 

Thanks.

 

Cyril

Viewing all 15932 articles
Browse latest View live


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