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

EPS Transparency

$
0
0

I was sent an indesign file that I am reformatting and making edits to and there is one object that when exported to PDF is not keeping the transparent background. I think this is because the image was inputted as an EPS image. I don't have the original image. Is there a way for me to have the EPS object maintain transparency or convert the image in a different way without the original image?


Read CSV File

$
0
0

Hi,

 

     I am using the below function to read csv file. Recently noticed this issue. I did not know why its happening.. is it related to eof reason or any other reason?

 

     When the csv file end of the row is only "F" its not returning by the function. When the empty para or the text para is given to the next line of "F", its returned. Why its happening?? is there is any reason...  How to handle this case?

 

 

     CSV :

CSV.png    

 

ReturnValues.png

 

  Empty Next Line (or) next line with contents:

 

Screen Shot 2018-09-27 at 1.19.00 PM.png

 

  Empty next line:

 

Screen Shot 2018-09-27 at 1.06.38 PM.png

 

Next line is bold:

 

Screen Shot 2018-09-27 at 1.06.59 PM.png

 

 

     Code:

 

function readFiles(filStr,fileFlag,column1,column2,column3,column4,columnArr){

    var readFil = File(filStr);

    var rCnt = 0;

    if(!readFil.exists){

        return false;

    }else{

        var fileContnts = "";

        readFil.open("r");

        if(fileFlag == "TXT"){

            fileContnts = readFil.read();

        }else{

             

            while(readFil.eof==false){

                try{

                    zRead=readFil.readln();

                   

                    var csvR = zRead.split(",");

                    if(rCnt != 0){

                        column1.push(csvR[columnArr[0]]);

                        column2.push(csvR[columnArr[1]]);

                        column3.push(csvR[columnArr[2]]);

                        column4.push(csvR[columnArr[3]]);

                        rCnt++;

                    }   

                }catch(e){}

                rCnt = 1;

            }

        }

        readFil.close();

    }

}

 

 

Regards,

Sudha K

Numbering pages in a chapter

$
0
0

Hi,

 

I would like to edit a file with this criteria:

 

1) consecutive page numbering in the bottom of the page.

 

APART FROM THAT I NEED:

 

2) on each chapter i need a line of text following an index structure such as:

 

     Chapter Number) Chapter Name / Subitem name / Page 1 of XX

    Ex.  1) Chapter Name / Subitem Name / Page 1 of 36

 

And the page numbering follow the number of the pages of that chapter, independently of the global page number.

 

Do anyone know how that can be achieved?

Please provide the Story Splitter script by Adi Ravid?

$
0
0

Hi,

 

I'm working on a complex book and need to split threaded stories at lots of places. I know I can do it manually through the Story Editor but have really set my eyes on the Story Splitter script created by Adi Ravid. I found its place @ the Adobe Exchange (http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1302 518#)  but get an error "We're sorry, we encountered an error processing your request." - also when pressing "Email author: Adi Ravid".

 

So, could someone who has the script please post it here?

 

Thanks a lot in advance

Applying object styles to multiple graphic cells frames

$
0
0

Hi!

 

I have a table that I'm changing the first row cells to graphic cells with this script:

 

app.selection[0].properties = {    leftEdgeStrokeWeight:0,    rightEdgeStrokeWeight:0,    topEdgeStrokeWeight:0,    topEdgeStrokeWeight:0,    innerColumnStrokeWeight:0,    graphicRightInset:2,    graphicLeftInset:1,    graphicBottomInset:2    };

app.selection[0].convertCellType(CellTypeEnum.GRAPHIC_TYPE_CELL, false);

 

First row selected after run the script:

 

tabela1.jpg

Before run the script:

tabela2.jpg

My question is: With the row selected like in the image, how can I reach (with a loop?) each frame inside each graphic cells to apply a object style? Without need to select one by one to apply?

 

My final goal is something like that:

tabela3.jpg

Hope that I explained in the right way.

 

Thanks in advance!

Read a line from txt file

$
0
0

Hello all,

I need to know how to read whole lines from any txt file. E.g. I have this in txt file:

 

testline1

testline2

testline3

 

and I need to read only line 2 (text "testline2").

 

I know how to read whole file:

 

var file = File(app.activeScript.parent.fsName + '/test.txt');
file.open("r");
var str = file.read(); // whole content of "test.txt" is now in variable "str"
file.close();

 

but I don't know how to read ONLY e.g. line 2. Can you help me with this someone please?

 

Thanks very much in advance

Get ip address,mac address etc.,

$
0
0

Hi,

 

  How to get system ip address, mac address etc., using indesign script.

 

Pls help

 

Thanks

Importing a .csv or .txt file into InDesign using Javascript to alter page attributes (and more).

$
0
0

Hi there,

 

Semi-new to scripting in general, very new to scripting for InDesign.

 

What I've been trying to figure out is exactly (and I do mean exactly!) how to import a .csv or a .txt file into a Javascript script, containing values that I can then designate to variables, and in turn use those variables to create a new InDesign document. I'd prefer to do this all from within the script… not importing anything using the DataMerge feature.

 

For example, the .csv file might look like this:

 

Height, Width, Margin, Bleed, AllBleed

17, 11, .5, .125, true

 

Then the script would import this file, and from the data it gets, creates the following variables:

 

var myHeight = Height;

var myWidth = Width;

etc.

 

From which the script would then create my document using myHeight, myWidth, myMargin, etc.

 

How would I go about doing this? And as a bonus, how would I do this for multiple documents (when the .csv file has multiple records)?

 

Thanks for any assistance on this!

 

-jOE


How do you select a layer by name using Javascript?

$
0
0

How do you select a layer by name using Javascript?

 

You can do this in Applescript using this code:

setactive layerofactive windowtolayer "Layout" ofmyDocument

 

I can't figure out the correct syntax in Javascript.

 

Anyone know how to do this?

 

Any information would be greatly appreciated,

adobeJavaScripter

Script to hide layer named "Draft" in multiple files.

$
0
0

new to scripting... please help! I have this script:

 

app.activeDocument.save();

 

 

var myWaterLayerName = "Draft";

 

 

try{app.activeDocument.layers.item(myWaterLayerName).visible = false;}

catch(_){alert("Can't find layer: " + myWaterLayerName);exit();};

 

that hides a layer in the active document. how can i modify to work on all open documents?

Script to select a color swatch?

$
0
0

What is the JavaScript code to select a color swatch in InDesign CS4, assuming I have the zero based index of the color swatch I want to select?

 

TIA,

Steve

Make change to all Document Styles using a script

$
0
0

Hello all! I am writing the script below and am needing some help. I am

wanting to change the language setting in all of the document paragraph

styles to German but when I use the "everyItem" property of paragraphStyles

it does not change any of the style definitions. Could somebody please give

me some help and directions? Thanks a million!

 

 

 

#target indesign

 

var myDocument = app.activeDocument;

 

var myStyles = myDocument.paragraphStyles.lastItem();

 

var myStyle = myStyles;

 

    try{

 

          myStyle.appliedLanguage = "German: 2006 Reform";

 

          alert("The language settings for all of the paragraph styles have

been changed to German: 2006 Reform.")

 

          }

 

    catch(e){}

 

 

How to get cloud library assets placed on document

$
0
0

I've been trying to find a way to get and use cloud library items in a document with Extendscript (InDesign CC 2018) but with no luck so far. We have multi-site operation and we're sharing libraries over the cloud. It happens that we're using ES too here and there, so it would be very nice to be able to use the library items with ES.

 

InDesign ExtendScript API (13.0)  site lists some interesting cloud related methods:

placeCloudAsset( jsondata:String ) //jsondata:String -JSON data containing metadata about the cloud asset

openCloudAssetForEdit( jsondata:String ) //jsondata:String -JSON encoded information about the asset to be edited.

setCloudLibraryCollection( librariesCollectionInfo:String ) //librariesCollectionInfo:String -JSON encoded information about cloud libraries collection

exportSelectionForCloudLibrary( to:File ) // to:File -The path to the export file.

exportForCloudLibrary( jsondata:String ) //jsondata:String -JSON encoded information about the export.

 

The common problem with these functions is that I cannot figure out how to get that JSON information of the cloud library. Can any one point me any directions direction with this? Any help is highly appreciated!

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

Pdf link for opening folder

$
0
0

Hi,

I would like to create a link which opens a folder and selects the specified file in it on Windows. It should work like explorer.exe with the /select switch.

Is it possible and if it is, how, please?


Copy image width and open with photoshop

$
0
0

Hi,

I have a document with a few hundred pages, and part of our standard workflow (do other people do this?) is to resize all the images to the print size (at 300ppi) in Photoshop, then sharpen for printing, then relink all images to the resized ones (so that the effective ppi of all images is 300ppi).

 

It seems like this would be made a lot less tedious by some simple scripting, so can someone help me get started? for now I just want to:

- copy the width of the image contained in the selected frame in mm to the clipboard

- open the file in Photoshop

 

I have an action in PS to take care of the resizing, so it's another keyboard shortcut, then paste in the width when the resize image dialogue pops up.

 

Eventually, I could imagine the script doing this, but I feel like I'm asking too much to do it all at once now!

- select first image

- if it is over or under 300dpi, open it in PS and run an action (with user input)

- go back to ID select the next image untill all are done

- relink all images to the new folder

 

Thanks already!

K

Find string of paragraph numbering

$
0
0

So I've made a script to change data in multiple tables. I want to target each table by looking for an index-number. This index-number is generated with a Paragraph Style Bullets & numberings (then using just a space to print that)inside a table cell. I wonder, is there anyway to actually target that value?

 

Here's a rough example:

 

Table oneindex_0
Value 1value 2
Value 3Value 4

 

Table Twoindex_1
Value 1value 2
Value 3Value 4

 

 

Here's my code that works with normal text in a cell:

 

app.findGrepPreferences.findWhat = "index_0"; // Find table with index  

With CS5, some things have changed

$
0
0

This discussion is for changes to the scripting DOM which can affect legacy scripts.

 

Please use this discussion for discussing new scripting features in CS5.

 

Please keep in mind that all changes are specific to version 7 DOM. InDesign supports versioning, so you should be able to use legacy scripts in CS5 without issues. Versioning can be done in two ways:

 

1) Place the script in a folder named: "Version 6.0 Scripts" (or 5.0, 4.0, 3.0). The folder must be named exactly as specified.

2) Set the script version preferences at the start of your script. (i.e. app.scriptPreferences.version = 6), but it's highly recommended to reset the scripting version at the end of the script, and even to enclose the script in a try/catch/finally block to ensure that the script preferences are reset correctly.

 

Here's quick links to issues brought up in this thread:

  1. PageItem.parent
  2. PageItem.itemByName()
  3. PageItem.cornerOption and PageItem.cornerRadius
  4. Text values returned as Strings instead of Numbers
  5. PointType.LINE_TYPE was changed to PointType.PLAIN
  6. PasteBoardPreference.minimumSpaceAboveAndBelow was removed.

Harbs

EPS Transparency

$
0
0

I was sent an indesign file that I am reformatting and making edits to and there is one object that when exported to PDF is not keeping the transparent background. I think this is because the image was inputted as an EPS image. I don't have the original image. Is there a way for me to have the EPS object maintain transparency or convert the image in a different way without the original image?

Please provide the Story Splitter script by Adi Ravid?

$
0
0

Hi,

 

I'm working on a complex book and need to split threaded stories at lots of places. I know I can do it manually through the Story Editor but have really set my eyes on the Story Splitter script created by Adi Ravid. I found its place @ the Adobe Exchange (http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1302 518#)  but get an error "We're sorry, we encountered an error processing your request." - also when pressing "Email author: Adi Ravid".

 

So, could someone who has the script please post it here?

 

Thanks a lot in advance

Viewing all 15932 articles
Browse latest View live


Latest Images

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