Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all 37788 articles
Browse latest View live

Re: Export selectd text as a jpeg

$
0
0

Hi,

I would not do the export of the frame within an XML rule.

Without the export InDesign will create more than two frames.

 

function sample(){

    this.name = "sample";

    this.xpath = '//*[@font="Medicine Symbols 1"]';

    this.apply = function (myElement, myRuleProcessor){

     with(myElement){

      var myframe = myDoc.pages[0].textFrames.add();

        myElement.placeXML(myframe);

        myframe.fit(FitOptions.FRAME_TO_CONTENT);

        //myframe.select();

        //var imageName = myElement.xmlAttributes.item('id').value''       

        //$.writeln (filepath = myFolder+"/"+imageName+".jpg");

        //myframe.exportFile(ExportFormat.JPG, new File(filepath), false);

        }

    }

}

 

thanks Stefan


Re: How to delete xml content without deleting the content of the object?

$
0
0

Hi,

 

1. Create a textframe and tag it with an xml Element (e.g. "myTextFrame")

2. Put some text in the textframe

3. Select the frame

4. run the script below

 

you added a new xml Element within the tagged frame and changed the content.

 

var curSel = app.selection[0];

var curXMLElement = curSel.associatedXMLElement;

var newXMLElement = curXMLElement.xmlElements.add('text');

newXMLElement.contents = "new Content";

 

Hope this makes sense.

 

Thanks Stefan

Re: find a column widh

$
0
0

Hi,

I have run into situations where I had to consider the stroke width left an right of the table. You might have to add that to your calculation of the column width.

 

Thanks Stefan

Re: How to delete xml content without deleting the content of the object?

$
0
0

I can't do this. I need to delete the contents of my associated xml element, without deleting the content of the text-frame. I need A) the textframe associated with my xml Element and B) the contents inside the xml tag <text>asd</text> gone, like: <text></text>, without deleting the frame content.

 

I did a little workaround now, althought this solution is not really clean.

 

I save the contents of the textframe in another variable, delete this content, and then assign the content to the xml attribute where I need it. Of course the user has to close the document without saving then.

 

text_value = xmlElements.add('text', current);

var textContents = text_value.contents;

var textSize = current.parentStory.characters.item(0).pointSize;

text_value.contents = '';

with(text_value.xmlAttributes){

    add('value', textContents);

}

Re: Set top and bottom inset spacing values in Text Frame Options via jsx script

$
0
0

Worked like a charm. Many, many thanks, Peter.

Current page (not Document) width and height with JSX

$
0
0

Hi,

I am trying to create a script that saves every page of the document and add its width and height to the name.

So far I managed to get the dimensions of the document using:

 

app.activeDocument.pages.documentPreferences.pageWidth;

app.activeDocument.pages.documentPreferences.pageHeight;

 

That's ok when all the pages in the document have the same dimensions (Document Preferences).

However, when I use custom pages that does not work.

 

I tried the code below but does not work either.


for(i=0; i<nb;i++)

{  

     app.activeDocument.pages[i].documentPreferences.pageWidth;

     app.activeDocument.pages[i].documentPreferences.pageHeight;

}

 

I have done some research and I don't seem to find any information regarding custom pages dimensions.

 

Can you please help with this?

 

Thanks in advance,

Isko

Can't ungroup

$
0
0

Hi,

I trying to ungroup the page items, the error displayed as per below, some hidden frames also displayed.

 

What is this (Brown frame), and guide to me.

 

Screen shot 2014-12-05 at 7.45.45 PM.png

 

Code here:

 

 

var myPages = app.activeDocument.pages;

for(i=0; i<myPages.length; i++)

{

   var mySelection = app.select(app.activeDocument.pages.item(i).allPageItems)

   var mSel = app.selection;

 

app.activeDocument.groups.add(mSel)

 

    }

Re: Can't ungroup

$
0
0

Sorry,

I trying to group all page items.


take variables from file to dizdir with indesign illustrator

$
0
0

hello

I want to I can not help but want to create a script with indesign summer.

I saw it somewhere in the job much easier. I variable objects in the opening pages of illistrator DAP records that biosya arranging a variable to take into 3 sections each section. After running the code comes with a screen indesign. writes the size of the objects from the screen. also choose custom size portion of it there. the next screen choose the illustrator file. entering the number of variables in the process. informs on how many units the field occurs on the page after the number of variables. draws the first variable to enter the file you want and how many pages will be sorted out. and when the script terminates at the end of the field is full. is prepared and completed design. I will set up my own business with my job a lot easier, but such a plugin. I would appreciate if you can help. Thanks to everyone

Re: Re: Can't ungroup

$
0
0

@selvam214 – when looking at your screenshot you are selecting objects that cannot be part of one group.

You cannot group anchored pageItems, nested graphics and "regular" pageItems to one group. And allPageItems will give you too much objects.

 

Another thing would be: You should add the group to a specific page.

Not just add the group to the document.

 

And you will have issues with locked page items…

 

//Locked pageItems could prevent items from beeing grouped.
//So we have to unlock all pageItems:
app.activeDocument.pageItems.everyItem().locked = false;

var myPages = app.activeDocument.pages;

for(i=0; i<myPages.length; i++){    //If there are no pageItems on a page, you cannot add a group.    //If there is only one pageItem on a page, you cannot add a group.    if(myPages[i].pageItems.everyItem().getElements().length > 1){        myPages[i].groups.add(myPages[i].pageItems.everyItem().getElements());        };

};

 

Uwe

Re: Can't ungroup

$
0
0

And about the "brown" frame:
It is the graphic that sits inside a rectangle.

 

Uwe

tab leaders in tables

$
0
0

Hi,

 

Anyone please suggest my code errors?

 

I need the leader dots in every first column of all the tables. tabs need to be stop before 6pts of the column width.

 

var myDoc = app.activeDocument;   

var myTable = myDoc.stories.everyItem().tables.everyItem().getElements();   

for(t=0; t<myTable.length; t++)   

{  

    var col = myTable[t].columns[0].select();

    var myFirstColumn = myTables[t].columns[0].width; 

    app.findGrepPreferences = app.changeGrepPreferences = null; 

    app.findGrepPreferences.findWhat = "(.+)$"; 

    found = app.selection[0].findGrep (true); 

for (i = 0; i < found.length; i++) 

{

  found[i].insertionPoints[-1].contents = "\t";

  TabStops.position = myFirstColumn - "6pt";      

}

 

 

The code shows the below error.

 

 

Regards,

Velu

layer hierarchy?

$
0
0

Hi all,

I can't figure out how to change the layer order of my current script.

Basically, the script creates a box with an outline (rule) onto a new layer, but this new layer sometimes ends up being created below other layers which obscure it.

Is there a way to make this new layer always be the topmost layer?

 

Here is the current script:

 

tellapplication "Adobe InDesign CS6"

  if (countdocuments) is notequal to 0 then

  --get the number of pages, page height and page witdth

  setpageCounttothenumberofpagesofactive document

  setpHeighttopage heightofdocument preferencesofactive document

  setpWidthtopage widthofdocument preferencesofactive document

  --calculate the witdht of the spread by the product of page width and page count

  setboxWidthto (pWidth * pageCount)

  --make a transparent rect with 1pt stroke around the spread

  tellactive document

  setzero pointto {0, 0}

  makenewlayer

  makenewrectanglewith properties {geometric bounds:{0, 0, pHeight, boxWidth}, fill color:"None", stroke weight:0.5, stroke color:"Registration", stroke alignment:inside alignment}

  endtell

  endif

endtell

 

 

Any advice would be greatly appreciated.

Thanks,
Dennis

Cycle number

$
0
0

Hi,

 

I am using in InDesign CS6 windows.

 

Customer needs a every correction pages should be a separate cycle number. 


In First proof stage the number always  should be "0"

In the first revisions the changed pages only should be "1" other pages remains the same.

In the second revisions the changed pages should be "2" other pages remains the same

 

The numbers remains the same content of the pages remains unchanged. If the content will change the number always change.

 

Is there any script available?

 

Regards,

Velu.

Re: tab leaders in tables

$
0
0

Hi VeluVK,

I'm not sure if I understand you right.

And I'm sure there are better possibilities to do what you want.

 

But with this little changes your code will run:

 

var myDoc = app.activeDocument;
var myTable = myDoc.stories.everyItem().tables.everyItem().getElements();
for(t=0; t<myTable.length; t++)
{    var col = myTable[t].columns[0].select();    //var myFirstColumn = myTables[t].columns[0].width;    var myFirstColumn = myTable[t].columns[0].width;    app.findGrepPreferences = app.changeGrepPreferences = null;    app.findGrepPreferences.findWhat = "(.+)$";    found = app.selection[0].findGrep (true);

for (i = 0; i < found.length; i++)
{  //found[i].insertionPoints[-1].contents = "\t";  //TabStops.position = myFirstColumn - "6pt";  found[i].tabStops.add( {position:myFirstColumn - 6});  found[i].insertionPoints[-1].contents = "\t";
}
}

 

Remember – I'm not an InDesign scripter.

Have fun

 


Re: How to adapt a Jongware's script for page numbers?

$
0
0

Thanks, Jarek.

I forgot to mark the CORRECT answer.

Re: Current page (not Document) width and height with JSX

$
0
0

Hi,

 

Notice page.bounds property ==> array like [y1,x1,Y2,X2], so in example:

currPageWidth = page[i].bounds[3] - page[i].bounds[1];

 

Jarek

Is it possible to set a log level for ID and/or IDS when opening an IDML?

$
0
0

We're finding that it's taking an excessive amount of time (30-45 minutes) to open somewhat larger files (~100 pages) with many hyperlinks (~10,000). Is anyone aware of a way to add a command line parameter to either Indesign.exe or IndesignServer.exe (as we use both) to set, for example, a more detailed log level to allow for seeing what is taking so long to process when opening a file? The output would presumably go to the Event Viewer or stdout / stderr in a Command Prompt.

convert marked text to xml

$
0
0

Hi,

 

Can any body help me on this.

 

In my indesign document, i have some text like: <math type="powermath"><mi>A</mi></math>

 

This content is present as normal text in the indesign documnet. I want to convert these text to proper XML tag within the InDesign itself.

 

Is there any way to do this.

 

Thanks,

Krishnan

Text variable, text update when opening file

$
0
0

Hi,

 

I'm looking for a possibility that when I open an indesign or incopy file, that a text follows the alphabet. That means that when you start

a document you see the letter A, when you save it and opens it again it becomes B. If Its possible the best custom variable text script should be a script where

the letter only changes when there is something changed in the document...

 

Can somebody help me where I can find something like this??

 

Dennis

Viewing all 37788 articles
Browse latest View live


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