Quantcast
Channel: Adobe Community : All Content - InDesign Scripting
Viewing all 8771 articles
Browse latest View live

Find manual leading adjustment by script

$
0
0

Hi,

 

How can we find leading was adjusted by manually in any paragrah styles. Is this possible by script?

 

by

hasvi


rename photos by page number

$
0
0

Hi everyone!

After I finish my project I have to send my project (book, magazine, etc.) to our archive.

And there is one problem, that takes a lot of time. Before sending project to the archive I must rename all photos by page number in which they are. For example: page_1.tiff, page_2.tiff... and so on. Is there any script that will do it automatically.

Detach 'Based on' masterspread's items in current masterspread

$
0
0

Hi All,

 

Is there is any way to detach 'Based on' masterspread's items in current masterspread through javascript. I'm trying it, but I could not do it.

 

Regards

love_all

Can someone help me to change the script function?

$
0
0

I have a script for indesign:


var link, image, frame, 
doc = app.activeDocument, 
links = doc.links, 
counter = 0; 
 
for (var i = links.length-1; i >= 0; i--) { 
    if (links[i].status == LinkStatus.LINK_MISSING) { 
        try { 
            link = links[i]; 
            image = link.parent; 
            frame = image.parent; 
            frame.remove(); 
            counter++; 
        } 
        catch (err) { 
            $.writeln(i + " - " + err); 
        } 
    } 
}


which is made by Kasyan Servetsky, function: remove all missing link objects, it runs very well, But only work on single file,
now I want change the function aim to let it work on all the open file,


for example I opened over ten files, all the file have missing like objects, I want to remove all the missing link objects in all the file by just one click the script,


is that possible?

Is there a TDD framework for InDesign ExtendScript?

Export images from indesign file with actual page name not working

$
0
0

Hi,

 

I've the following script with export's all images from an indesign file as a jpeg in an export folder.

 

The only problem i have is, I would like to have the page number in the file name of the image.

 

But at the moment this isn't working, the page number isn't correct. Does anybody know how to fix this?

 

Thanks so much,

 

---------------

 

var myDoc = app.activeDocument;

var docName = myDoc.name;
var docShortName = docName.replace(/.indd/, '');
var docPath = '' + myDoc.fullName;
var docContainerPath = docPath.replace(docName, '');
var destPath = docContainerPath + '/' + docShortName + '_jpgExport/';

if(Folder(destPath).create() != true){
     alert('Could not create targetfolder.');     exit();
}

var myImage = myDoc.allGraphics;

for (var i=0; myImage.length>i; i++){     app.select(myImage[i]);     var page = myDoc.pageItems[i].parentPage.name;     var MyImageName  = myImage[i].itemLink.name;     app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;     app.jpegExportPreferences.exportResolution = 300;     app.selection[0].exportFile(ExportFormat.JPG, File(destPath +"page_" + page + "_" + MyImageName + ".JPEG"), false);
}

Script for batch delet redundant layer

$
0
0

I have thousands files in the different folders, each file has same layer named “Job Info”. Can someone help me to write a script for del this layer folder by folder?

 

layerInfo.jpg

 

I expected the script tells me that I have to select a folder, then it can automatically open the files, del “job info” layer then save file, rewrite, close file

turn off live update of cross references

$
0
0

I'm using Indesign CS6 and javascript.

Is there a way to temporary turn off the 'live update' feature of cross references between separate indesign files?

We find this feature to be a real pain if more than one person is trying to work with the files as it slows everything dramatically.

 

I've searched through the DOM and Adobe InDesign CS6 (8.0) Object Model JS: Table of Contents but I guess I don't know the right terminology to look for.

 

Hope you can help.

Thanks,

John


Correct my 'indesign file' move script

$
0
0

Hi,

 

How can I place the "Template File.indd" in newly created "Folder 1". Here my output file is saved as a "Template File.indd", now I want to create new folder name as like "Folder 1". Then I want to place the "Template File.indd" in "Folder 1".

 

this is my code:

 

var path = Folder.selectDialog ("Select folder");
if(path==null)
{    exit();    }


var files = path.getFiles(/\.(indd?|indt?)$/i );
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;


try
{
myDocument = app.open(new File(files));
myDocument.save(new File(path + "/" + "Template File.indd"));
}
catch(e)
{
alert ("Your folder permissible only one file of 'INDD' or 'INDT' file");
exit();
}

 

by

hasvi

Adding text from a palette to a selected text frame

$
0
0

Hi everyone,

 

I'm working on script that read XMl files on a palette. Then choosing one, I can see the nodes and the text content in a treeview. My purpose is to paste text into a textFrame on the InDesign document, that first copy on a palette.

 

It is possible ?

May be a good drawing is better than a long speech!

indiscript.png

Best regards

JavaScript fill curent layout color Black

$
0
0

hello, i have a javascript to setup a new document to the correct page size etc.

BUt i want it also to have a colour black background and not white, is this possible with Javascript and the document setup?

 

Thanks

Multi paged document into individual PDF pages - with names

$
0
0

I have an InDesign document that I use to create sell sheets for groups of sales people using data merge.

I'm wondering if there's an easy way to extract these pages as individual pdf pages that have the names of each page (D_Smith.pdf, RJones.pdf etc.)

 

Currently I do this using Acrobat and extract pages and manually tag each pdf.

frozen overflows

$
0
0

Hi,

 

Could you help me to find a reason of this effect:

myTable is 4 cells table - all with some text contents.

First - I set every cells width to 6pt (all overflows) and second - i try to grow width till overflows is true.

If I run this loop as a part of bigger code - it is a neverending loop.

Alert show me cell width step by step, and even it is bigger then the content needs - overflows keeps value: true.

If I stop script (is started from ESTK) - overflows is false.

 

If I run this loop as a separate part of code - everything is OK.

.....

for (var k = 0; k < myTable.cells.length; k++)

     {

            do {

               myTable.cells[k].width ++;

               alert (k + ": " + myTable.cells[k].width + ": " + myTable.cells[k].overflows);

                 }

            while (myTable.cells[k].overflows);

     }

.....

 

where should I look for mistake if this overflow property's seems like frozen?

How to make at startup script that fits spread on open

$
0
0

Hi there,

Does anyone know how to make a startup script for InD CS6 that fit spread too screen when document open?

I've tried this and it works but I've get a dialog that says "Object is not valid":

 

#targetengine "session"

 

main();

function main(){

var myEventListener = app.eventListeners.add("afterOpen", excuteScript);

}

 

function excuteScript(){

var myD = app.documents[0];

 

app.layoutWindows[0].zoom(ZoomOptions.FIT_SPREAD);

 

}

Creating Spot color in InDesign CS4, js

$
0
0

Hi,

 

I have this code:

 

try{
myColor = myDoc.colors.item("EMBOSS");
myName = myColor.name;
}
catch (e){
myColor = myDoc.colors.add({name:"EMBOSS", model:ColorModel.SPOT,
colorValue:[100, 0, 0, 0]});
}

 

But the color created still process. How do I change it to spot color.

 

 

Thank you.


Can i copy text that's in a specific char. style to an anchored object using a script?

$
0
0

Hi,

i was just wondering, is it possible to copy words that are in a specific paragraph style to an anchored text frame, using a script.

For example this sentence:
Is this possible? Yes it is.

The whole sentence has the paragraph style ‘question’.
The sentence ‘Yes it is’ has a char. style ‘solution’.

Can a script cut all the words with char. style ‘solution’ and place it in an anchored text frame at the same spot?

I hope you understand what i’m trying to achieve.
This is a bit hard to explain in words.

regards
Arne

example.jpg

Table cells - Problem with merged cells

$
0
0

Hi

I was experiencing very weird behavior with my tables until I realized that it was caused by merged cells

My script gives a dialog which allows the user to choose from which column to start and from which row.

As the script iterates through the cells in the selection I was getting weird results

Through using .select() function I was able to see that depending on the column, some times row 5 could be which seems to be row 3!

The reason was because of merged cells in that row

I.e., when some cells are merged together, only the first column of those merged cells is recognized - the others are not

so it comes out that when merging cells from column 3 to 5, column 3 has a cell in that row, columns 4 and 5 do not, and column 6 does!

 

Is there a way to get around this behavior?

 

 

Thanks

Davey

Automate fractions using a script.

$
0
0

Hi,

 

i was looking to automate the layout of fraction with a script.

The script has to change 1/200, 1/20, 1/33 to fractions:

 

Picture-2.gif

When we do it manually, we insert an anchored textframe which contains a 2 row/1 column table.

We then copy the numbers in the cells.

 

I found the script below in a previous discussion.

But i get an error 30480 on line 14.

I'm a bit of a dummy when it comes to scripting, so can anyone tell me what's wrong with it?

 

-------------------

var theDoc = app.activeDocument;

 

var myTableStyle = "tabelbreuk"; //MUST  be set!!

var myCellStyle = "celbreuk"//MUST  be set!!

var myObjectStyle = "TF-breuk"//MUST  be set!!

 

app.findGrepPreferences = null; 

app.findGrepPreferences.findWhat = "\\d+/\\d+";   //should find all occurrences of number(s) + / + numbers(s)

var searchResults = theDoc.findGrep(); 

 

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

{

var foundFraction = searchResults[i];

var newTextFrame = foundFraction.insertionPoints[0].textFrames.add({geometricBounds: [0,0,foundFraction.leading, foundFraction.parentTextFrames[0].geometricBounds[3] - foundFraction.parentTextFrames[0].geometricBounds[1]], appliedObjectStyle:theDoc.objectStyles.itemByName(myObjectStyle)});

var tmpDest = foundFraction.move(LocationOptions.AT_BEGINNING, newTextFrame);

var fractionTable= tmpDest.convertToTable('\r', '/', 1);

fractionTable.appliedTableStyle = "tabelbreuk"

setTableWidth(fractionTable);

newTextFrame.fit(FitOptions.FRAME_TO_CONTENT);

        }

 

function setTableWidth(fractionTable){

    var widthArray = [];

        var allCells = fractionTable.cells;

   for(var c = 0; c < fractionTable.cells.length; c++){

        var aCell = fractionTable.cells[c];

                aCell.appliedCellStyle = "celbreuk"

widthArray.push((aCell.texts[0].endHorizontalOffset - aCell.texts[0].horizontalOffset) + aCell.leftInset + aCell.rightInset)

    }

widthArray.sort(Numsort);

fractionTable.width = widthArray[widthArray.length-1]

}

 

function Numsort(a,b){return a - b}

--------------------------------

 

thx

Script to navigate to next or previous document

$
0
0

Hi,

since CC it's impossible to assign the shortcut CTRL-TAB to "next document" and CTRL-SHIFT-TAB to "previous document"

what I found out is, that it is possible to assign these shortcuts to a script, so, if I had a script that go's to next document and one to go to previous document, I can assign those shortcuts to these scripts and my problem is solved (in a way)

 

So now I have two little questions,

1. how to make a script that takes me to the next  document

2. how to make a script that takes me to the previous  document

 

I know how to edit scripts, but scripting itself is like Chinese for me :-)

 

Thanks in advance for helping me out!

Summing cells in a row

$
0
0

Hi

I have a table with many rows

Sometimes I have to choose a few cells from a few columns and do some mathematical equation, and write into another cell

E.g. I select columns 3-5 in rows 8-20

I want to row by row get sum of the 3 columns selected, and the print it into the next column - column 6

 

Is there an easy way to work with the cells selected in this situation

Or do we have to iterate through the cells until we find which ones are selected and getting the row# and column# of the table

 

If someone can help me we this I'd appreciate it

 

Thanks

Davey

Viewing all 8771 articles
Browse latest View live


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