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

add reply indesign notes

$
0
0

How to add reply for indesign notes.

This feature is available in indesign


Import .eps file script?

$
0
0

Hi all,

 

I am using InDesign CS6 and need help with a script (JavaScript) 

 

I'm doing the exact same thing as this previous discussion below, Exporting MathType equations from Word as EPS files and then trying to place them into my indesign file.

 

Batch importing eps equations into Indesign

 

Since this discussion, is there a better script or method to import .eps files? (see screenshot below)

 

I placed my Word file into InDesign. What I think this script is supposed to do is replace all the @Equ021.eps@ file names with those images in the file path on line 23.

 

Below is the script I am using and apparently all I needed to do was save my script after I entered the path name on line 23. (The person who gave me this no longer works with me so I am on my own)

When I try to save, I receive the error:

error.png

I'm very new to scripting so what does this error below mean, and what do I need to do to fix it?

scrpit.png

 

Thanks for any help! I have thousands of these equations and would hate to import them one by one.

ScriptUI for dummies

$
0
0

I've been putting together a text on ScriptUI, to a large extent to clear up things for myself (hence the title!). It's an introduction to ScriptUI, much of it very basic, here and there going into some detail. It's not a finished product, and comments, suggestions, and corrections are welcome. If you're interested, you can find the PDF file here: http://www.kahrel.plus.com/indesign/scriptui.html

 

Peter

[JS CS3/4] ScriptUI How to color a button ?

$
0
0

Is it a way to get a colored button in the ScriptUI DOM ?

 

I tried

 

dlg.button1.graphics.backgroundColor = dlg.button1.graphics.newBrush(dlg.button1.graphics.BrushType.SOLID_COLOR,[0.7,0.7,0.7],1);

 

But although the dialog is drawn, the button is not styled in best case, not visible in the worst case.

 

Is that possible to get a colored button ?

 

Hope so.

 

Do you have any tip ?

 

TIA

 

Loic

cells strokes fill color to none

$
0
0

Hi experts

 

Could someone show me how to full stroke color to none.

 

regard

John

 

how to make it works?

 

    app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().strokes.every Item().fillColor = "None";

[JS] :: [CSX] - PageItem Stacking Order

$
0
0
Hi folks,

Does any one here have any knowledge and or experience on how indesign handles the stacking order of page items.

I have a simple script which can be viewed here:
http://home.exetel.com.au/thunder/img/simpleScript.js

The indesign file I am opening can be downloaded here:
http://home.exetel.com.au/thunder/img/sample%20Folder.zip

I am trying to use the index property of pageItem to determine the proper stacking order--I am trying to sort the page Items from top down.

In This example inDesign reports that the object 'little circle' is underneath 'big Circle' and the index numbers in general do not seem to match how I have placed the objects on top of each other in the document.

Is this the correct way to determine stacking order?

RSA Library for ExtendScript?

$
0
0

Hi,

has anyone been able to implement a JS library for RSA encryption in ExtendScript?

I've been using CryptoJS quite successfully, but it lacks a RSA module. I've tried travist/jsencrypt · GitHub with no luck (ExtendScript complains for few things, like window and navigator), I'll be trying digitalbazaar/forge · GitHub too in the next days.

Any suggestion is welcome.

Thank you!

 

Davide Barranca

open docs add layer

$
0
0

Hi experts

 

Could some show me how make this script working?

thanks

 

Regard

John

 

        var docs = app.documents;

        for (var i = docs.length-1; i >= 0; i--) {

                docs.layers.add({name: "pics"});

                docs.rectangles.everyItem().itermLayer = "pics"

                }

      alert("Finish.") 

 

I want add a layer "pics" in all open docs, then move all pics to the layer "pics".


Finally! A progress bar for AppleScripters!

$
0
0

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 this post 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

How to open instanceof folder

$
0
0

Hi experts

 

I want to open the indd files which in the instance of folder.

How can I make it works.

my script as below, could some tell me what's wrong with the script.

 

Regard

John

 

 

#target indesign

       app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

       var folder = Folder.selectDialog ("Select the root folder");  

       var myfiles = [];  

       getsubfolderfiles(folder);  

       for(var i =0;i<myfiles.length;i++)  

                        {  

               var docs = app.open(myfiles[i]);  

                                    for (i = docs.length-1; i >= 0; i--) {

                                        var myTables = docs[i].stories.everyItem().tables.everyItem().getElements() 

                                            for ( t = 0; t < myTables.length; t++ ){ 

                                                    myTables[t].cells.everyItem().texts.everyItem().fillColor = "Black"; 

                                                    myTables[t].cells.everyItem().fillColor = "None"; 

                                                    myTables[t].cells.everyItem().leftEdgeStrokeColor = "None"; 

                                                    myTables[t].cells.everyItem().rightEdgeStrokeColor = "None"; 

                                                    myTables[t].cells.everyItem().topEdgeStrokeColor = "None"; 

                                                    myTables[t].cells.everyItem().bottomEdgeStrokeColor = "None"; 

                                                    } 

                                        } 

                               }    

                          

                          

                    function getsubfolderfiles(folder)  

                              {  

                                  var filelist = folder.getFiles();  

                                  for(var i =0;i<filelist.length;i++)  

                                  {  

                                      if(filelist[i] instanceof Folder)  

                                      {  

                                          getsubfolderfiles (filelist[i]);  

                                      }  

                                      else if(filelist[i] instanceof File)  

                                      {  

                                          if(filelist[i].name.indexOf(".indd") > -1){  

                                              myfiles.push(filelist[i]);  

                                          }  

                                      }  

                                  }  

                              } 

 

 

                                   

                             var docs = app.documents;

                                 for (var i = docs.length-1; i >= 0; i--) {

                                     if(docs[i].saved == false){

                                           docs[i].close(SaveOptions.NO);

                                         }

                                     else if(docs[i].close(SaveOptions.YES));

                                    }

                          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

                         

                          alert("Finish.")

Struggling to understand CoordinateSpaces using resolve method

$
0
0

As the title of my post says... I'm struggling to understand CoordinateSpaces. I read the description provided in the 'Adobe InDesign CS6 JavaScript Scripting Guide' and I created a simple document to confirm my understanding. But the results I received were not as expected and I don't think I understanding some core concepts.

 

I will write some blocks of code and then try to explain what I think they work.

 

$.writeln( document.selection[0].resolve( [[0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS], CoordinateSpaces.PAGE_COORDINATES )[0] );

 

This functions as I expected. The following is a breakdown of the arguments and my understanding of them:

  1. [0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS
    1. [0,0] – anchor position relative to the object bounds – Top Left
    2. BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS –  I am assuming that this makes the anchor position relative to the PageItem's path where as OUTER_STROKE_BOUNDS makes the anchor position include stroke weight extending past the PageItem's path
  2. CoordinateSpaces.PASTEBOARD_COORDINATES – Is the location of the anchor point within the pasteboard coordinate space


Now this is all understandable but then I saw the following code on indiscripts:

 

$.writeln( document.selection[0].resolve( [[0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, CoordinateSpaces.INNER_COORDINATES], CoordinateSpaces.INNER_COORDINATES)[0];


  1. [0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, CoordinateSpaces.INNER_COORDINATES]
    1. [0,0] – as above
    2. BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS – as above
    3. CoordinateSpaces.INNER_COORDINATES – This bit I don't understand. I read the Adobe InDesign CS6 JavaScript Scripting Guide and it seems to suggest that this is the location of the anchor point within the coordinate space. But that doesn't make sense to me because thats what the last argument is meant to do isn't it?
  2. CoordinateSpaces.INNER_COORDINATES – Confused now because of point above


So as you can see this example the introduction of a coordinate space in the first argument confuses me. If somebody could help me understand its purpose I would really appreciate it.

 

Also I have the following questions about coordinate spaces:

  1. PARENT_COORDINATES – Wouldn't this just be spread? All PageItems parents are a spread right?
  2. INNER_COORDINATES – What is this!? Documentation says it's the coordinate space the object was created in. How can I tell what coordinate space an object is created in? Why is this usful? If I draw a rectangle on a page is its created the pasteboard, page, or spread coordinate space?

How define table

$
0
0

Hi experts,

 

I have a script for find table and change properties.

Could someone show me how to make it works.

 

Regard

John

 

                        myDoc = app.activeDocument;

                        findTable();

                        function findTable(){

                            for ( s = myDoc.stories.length-1; s >= 0; s-- ){

                                for ( t = myDoc.stories[s].tables.length-1; t >= 0; t-- ){

                                    myTable = myDoc.stories[s].tables[t];

                                    tables[t].cells.everyItem().texts.everyItem().fillColor = "Black";

                                    tables[t].cells.everyItem().fillColor = "None";

                                    tables[t].cells.everyItem().leftEdgeStrokeColor = "None";

                                    tables[t].cells.everyItem().rightEdgeStrokeColor = "None";

                                    tables[t].cells.everyItem().topEdgeStrokeColor = "None";

                                    tables[t].cells.everyItem().bottomEdgeStrokeColor = "None";

                                }

                            }

                        }

                    alert("Finish.") 

how to ignore or skip the empty cells in a table using indesign javascript.

$
0
0

i dont want to delete or remove the empty cells in my table , but i want skip or ingore the empty cells..

when doing tab alignment to that table..

Tables and boxes in eps format

$
0
0

I need to convert tables and boxes in eps format. Is this possible via scripting.



need a script for hyperlink data merge placing numerous and different urls into text

$
0
0

I need to find a script that can take urls from a .txt file and merge them into an indesign document INTO text that reads "LINK TO ARTICLE". There are many different urls going into the document. I can already do the data merge and it places the url in text form. Then i can convert them to active hyperlinks. What i need to be able to do is insert the urls as a hyperlink into the text, rather than just showing a long string of text/url.

Any help?

Thank you very much!!!

AD


Getting the footnote number for index entries which are in footnotes

$
0
0

I am laying out a scholarly book, and have just finished the index. Now I need to find which entries are in footnotes, and get the footnote number. I will then manually edit the generated index to include the footnote numbers. Each chapter is in a separate story within the same Indesign document (not an Indesign Book), and the footnote numbering starts over at the beginning of each chapter/story. I have also included some of the front matter in the index, so I do have entries in lower-case roman numerals.

 

Example.

Original: A se ipso (Aseity) 190, 231, 253, 269, 270, 272, 274

Edited: A se ipso (Aseity) 190, 231nn96-97, 253, 269, 270n201, 272, 274

 

The logic I am thinking of would go something like:

Open new document

For each index entry

     If (in footnote)

          Get and output: topic, (tab) page number/range associated with entry, (tab) footnote number (new line)

     end if

end For Each

end script

 

Alternatively, I could

     Search through only footnotes

          at each entry output: topic, (tab) page number/range associated with entry, (tab) footnote number (new line)

 

In another thread, I saw this:

  1. myFoot = app.selection[0].footnotes[0]; 
  2. whichOne = myFoot.index - myFoot.parent.footnotes[0].index; 

 

This may be what I am looking for, but i am not yet sure, since I also saw that "index" refers to the z-order.

 

Unfortunately, I am not familiar with Indesign Scripting, so the actual piecing it together by myself is, currently, beyond me. I could do this manually (I have started doing so) but that will take quite a while, and this book is already overdue.

 

God reward you,

brother Charles, FI

[JS CS3/4] ScriptUI How to color a button ?

$
0
0

Is it a way to get a colored button in the ScriptUI DOM ?

 

I tried

 

dlg.button1.graphics.backgroundColor = dlg.button1.graphics.newBrush(dlg.button1.graphics.BrushType.SOLID_COLOR,[0.7,0.7,0.7],1);

 

But although the dialog is drawn, the button is not styled in best case, not visible in the worst case.

 

Is that possible to get a colored button ?

 

Hope so.

 

Do you have any tip ?

 

TIA

 

Loic

Find nested characters and apply the Cstyle

$
0
0

I

want to find the nested applied characters and apply the Cstyle, but my code capture all those text in a document. Can you please guide to me,

 

nestedreport();

function nestedreport(){

var myDoc = app.activeDocument;

var myDocPath = myDoc.filePath;

var myDocName = myDoc.name;

 

 

try{

app.findGrepPreferences = app.changeTextPreferences = null;

app.findGrepPreferences.findWhat = "^.+";

myFind=myDoc.findGrep(false);

 

var ntexts = new Array;

for(i=myFind.length-1;i>=0;i--)

{

    if(myFind[i].contents.nestedStyles==null)

    {

        ntexts.push(myFind[i].contents)

        ntexts.appliedCharacterStyle="Nested";

        }

    }

}

catch(e){}

 

}

 

 

Screen shot 2015-07-21 at 2.26.33 PM.png

Removing a table (VBA)

$
0
0

Hi, All.

 

How do I remove a table?

 

MySpread.TextFrames(I1).Tables(I2).Remove - doesn't work.

 

 

Thanks in advance.

XML attribute change

$
0
0

I need to replace the xml attribute value "M05_LEMO9433_06_SE_CH05" to M05_LEMO5401_06_SE_CH05

 

 

In document having more than thousand entries

 

 

I have used the below code but it is not working

 

 

function AddReturns(){

    this.name = "AddReturns";

    this.xpath = "//p//span//a";

    this.apply = function(myElement, myRuleProcessor){

 

 

        with(myElement)

  {

  try{

                   

              //      if (myElement.xmlAttributes.item("href").value.match ("LEMO9433 "))

                        {

                           

                            var fig = myElement.xmlAttributes.itemByName("href").value;

                            var    figv =  fig.replace ("9433", "O5401")

                            myElement.xmlAttributes.itemByName("href").value=figv;

 

 

                            }

                   

                   

  //myElement.xmlAttributes.item("id").name = "olinkend";

  }catch(e){}

 

        }

        return true;

    }

}

Viewing all 15932 articles
Browse latest View live


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