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

Re: How to highlight tracking value in the java script


Re: How do I retrieve leading in points if set to AUTO?

$
0
0

Leading is a property of the whole Text class, from paragraphs down to insertion points.

One character can dictate the "effective" leading of a whole line of text, if Leading.AUTO is applied to it.  //EDIT

 

Changing the leading of one single insertionPoint can change the leading of a whole paragraph, if the document TextPreferences are set to do so with useParagraphLeading set to true.

 

The "effective" leading can also be influenced by the baseline grid of the document or the text frame's BaselineFrameGridOptions as well.

If there is Leading.AUTO applied inline anchored objects also play their roles.

 

Text wrap of objects…
Etc.pp. …

 

Uwe

 

// EDIT

Re: How do I paste to the spread?

$
0
0

To expand on Loic's succinct but great answer, do not use app.copy/app.paste etc. There are almost no instances where that is a good idea.

Instead use the duplicate() and the move() methods available for page items.

Iterate through the pageItems collection of your source document (not the allPageItems array, since that also contains items nested in groups), and duplicate each pageItem into the target document, then position it at the desired location.

See:

http://www.indesignjs.de/extendscriptAPI/indesign11/#PageItem.html#d1e190150__d1e191826

and

http://www.indesignjs.de/extendscriptAPI/indesign11/#PageItem.html#d1e190150__d1e191881

Paste with formatting from word file

$
0
0

Hi,

 

I doing copy and paste of texts from word file to Indesign. I need to keep all italic, bold etc.

 

My logic is :

 

1) Enable the Clipboard Handling as shown below

Screen Shot 2016-02-12 at 3.02.58 PM.png

 

2) Assign cmd+v to execute my script in keyboard shortcuts.

Screen Shot 2016-02-12 at 3.04.24 PM.png

 

3) So when i press cmd+v it executes the script.

 

4) Below is the sample code i tried. In my Document i already have 'Bold' character style in style group.

 

app.menuActions.item("$ID/Paste").invoke(); //assigned cmd+v as shortcut
var myDoc=app.activeDocument; 
app.findTextPreferences = null;     app.changeTextPreferences = null; 
app.findTextPreferences.fontStyle="Bold";
app.changeTextPreferences.appliedCharacterStyle=myDoc.characterStyleGroups.itemByName("General").characterStyles.item("Bold");
app.changeText(); 


//app.menuActions.item("$ID/Clear Overrides").invoke();

 

 

It doing as expected. My requirement is:

 

1) I need to override my paragraph style.

 

2) I used app, so the script running slowly. How i can do it better fastly.

 

I saw others script to creating paragraph styles but i am trying to create script my own logic.

 

Thanks,

Karthi

Find text change to Glyph

$
0
0

Hello

 

I 'am looking for a script that find text and change it to a glyph with a color for example red.

Something like this:

Find #H and change it to glyph unicode 2665 with font ITC Zapf Dingbats Std and color name Red.

Find #R and change it to glyph unicode 2666 with font ITC Zapf Dingbats Std and color name Red.

Find #K and change it to glyph unicode 2663 with font ITC Zapf Dingbats Std and color name Black.

Find #S and change it to glyph unicode 2660 with font ITC Zapf Dingbats Std and color name Black.

I use Indesign CS6 on mac.

 

Kind regards

Patrick

Re: Paste with formatting from word file

$
0
0

You can import the word file with enabled options import show and to map styles. Bold and word Italico should be done with character style in Word. So they can also be mapped in Indesign.

Screen Shot 2016-02-12 at 8.49.19 AM.png

numbering with text

$
0
0

I need numbering my pages some like this: e.g. (14 fourteen…. 15 fifteen….).

Is it possible with java script? On Indesign cs6?

hug

Re: Paste with formatting from word file

$
0
0

Hi Leo,

 

Thanks for your response.

 

My requirement is copying and pasting from word file. Not Importing. Because i need to update some content in my indesign file based on new word document.

 

Regards,

Karthi


Re: Paste with formatting from word file

$
0
0

Try for Grep, follows a code that I have used to replace ordinal:

 

        app.findGrepPreferences = NothingEnum.nothing;

        app.changeGrepPreferences = NothingEnum.nothing;

              

        app.findChangeGrepOptions.includeFootnotes = true;

        app.findChangeGrepOptions.includeHiddenLayers = true;

        app.findChangeGrepOptions.includeLockedLayersForFind = true

        app.findChangeGrepOptions.includeLockedStoriesForFind = true;

        app.findChangeGrepOptions.includeMasterPages = true;  

      

        app.findGrepPreferences.findWhat = "o";

        app.findGrepPreferences.appliedParagraphStyle = "•00_titulo_unidade_2_CV";

        app.findGrepPreferences.underline  = true;

        app.findGrepPreferences.position = Position.SUPERSCRIPT;

        app.changeGrepPreferences.changeTo = "º";

        //app.changeGrepPreferences.appliedCharacterStyle = "Superscrito_titulo_unidade_2_CV";

        app.activeDocument.changeGrep();

       

        app.findGrepPreferences = NothingEnum.nothing;

        app.changeGrepPreferences = NothingEnum.nothing;

 

Good luck, hug!

Re: numbering with text

Re: Paste with formatting from word file

$
0
0

Hi Leo,

 

Thanks for your response.

 

One thing i have to say, if you copy one paragraph with italic and paste into indesign document, it will lost its italic style. I did the paragraph style override. See the tried coding, it is working fine

 

app.menuActions.item("$ID/Paste").invoke();
var myDoc=app.activeDocument; 
var mySel=app.selection[0];
var mypara=mySel.paragraphs[0].insertionPoints[0].paragraphs[0].appliedParagraphStyle.name;
app.findTextPreferences = null;     app.changeTextPreferences = null; 
app.findTextPreferences.fontStyle="Bold";
app.findTextPreferences.appliedParagraphStyle = mypara.toString();
app.changeTextPreferences.appliedCharacterStyle=myDoc.characterStyleGroups.itemByName("General").characterStyles.item("Bold");
app.changeTextPreferences.appliedParagraphStyle =mypara.toString(); 
app.changeText();

 

Now my problem is this paragraph style is in style group. I have to get from the different style group and reapply.

 

The above coding will work perfectly if the paragraph style is not in style group

 

Regards,

Karthi

help: place inline equations (eps), automatically adjust baseline and leading of surrounding text...windows/javascript

$
0
0

Trying to find solution for adjusting baseline and leading on 1000s mathtype inline equations in indd.

What i want is script which can read from ALL eps links baseline info and move it to correct position and after that adjust leading of surrounding text to +166% (2/3 more than baseline) of that baseline.

 

Here is little code which move (selected) equation to correct position but not adjust leading of text line.

var fp = app.selection[0].graphics[0].itemLink.filePath;

var f = File(fp);

f.open('r');

var fs = f.read();

f.close();

var baseline = fs.match(/%%Baseline:\s+(\S+)/)[1];

app.selection[0].anchoredObjectSettings.anchorYoffset = -Number(baseline)+"pt";

Applescript Indesign: Add leading Zeros to page numbering

$
0
0

Hi All

 

I'm creating a new doc from scratch but I need the auto page numbering to have 3 leading zeros, Can someone help me with the syntax?  I've found references to 'numbering format' and 'triple leading zeros' in the directory, but I keep getting the following error when trying to set them to page 1…

 

    Adobe InDesign CC 2015 got an error: Can’t set numbering format of page 1 of document id 461 to triple leading zeros.

 

thanks again.

 

Shane

 

tell application "Adobe InDesign CC 2015"
   -- set user interaction level of script preferences to never interact
   activate
   --
   --
   make new document with properties {document preferences:{page width:"110mm", page height:"219", pages per document:15, facing pages:false, allow page shuffle:false, document bleed top offset:0, document bleed uniform size:true}}
   --
   --
   set myDoc to document 1
   --
   set selection to master spread 1 of myDoc
   tell master spread 1 of myDoc
       set myRectangle to make rectangle with properties {fill color:"None", stroke color:"None", stroke weight:0, geometric bounds:{59, 29, 221, 110}}
   endtell
  
   set numbering format of page 1 of myDoc to triple leading zeros
  
   (*
   Adobe InDesign CC 2015 got an error: Can’t set numbering format of page 1 of document id 461 to triple leading zeros.
   *)

  
  
endtell

Re: Paste with formatting from word file

$
0
0

Hi,

 

How to get paragraph style name from group? Or is it possible to invoke the Clear Overrides from menu action?

 

Screen Shot 2016-02-12 at 6.25.57 PM.png

Re: Script who checks - and stop - if text has overset

$
0
0

var doc = app.activeDocument;  

var mTextFrames = doc.textFrames;

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

    if (mTextFrames[i].parentStory.overflows){

        alert('Der er for meget tekst i et eller flere tekstfelte - dette skal fjernes inden du trykker SHIFT+ALT+X igen' )

  }

}

var mLinks = doc.links;

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

    if (mLinks[i].status == LinkStatus.LINK_MISSING || mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE){

        alert('Der er links som enten mangler eller ikke er opdateret - Find eller opdatér linket inden du trykker SHIFT+ALT+X igen' );

  }

}

  if(mTextFrames = true){

  exit();

  if(mLinks = true){

  exit();

  }

}

var doc = app.activeDocument;

var _PDFfile = new File('\\\\testserver' + app.activeDocument.name.replace (/\.indd$/, '.pdf'));

 

 

var _PDFExportPreset = app.pdfExportPresets.item('MyPDFPreset');

if (_PDFExportPreset == null){

  alert('PDF Export Presets not found');

  exit();

 

 

}

app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;                

doc.exportFile(ExportFormat.pdfType, _PDFfile, false,_PDFExportPreset);

 

This script does the work IF there is OVERSET Text and/or MISSING or OUT_OD_DATE link in the document!

 

BUT

 

If there is NO OVERSET TEST or MISSING or OUT_OF_DATE link in the document the script don't run this part:

var doc = app.activeDocument;

var _PDFfile = new File('\\\\testserver' + app.activeDocument.name.replace (/\.indd$/, '.pdf'));

 

 

var _PDFExportPreset = app.pdfExportPresets.item('MyPDFPreset');

if (_PDFExportPreset == null){

  alert('PDF Export Presets not found');

  exit();

 

 

}

app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;                

doc.exportFile(ExportFormat.pdfType, _PDFfile, false,_PDFExportPreset);


Re: Applescript Indesign: Add leading Zeros to page numbering

$
0
0

Hi,

 

try this ...





-- set numbering format of page 1 of myDoc to triple leading zeros -- [wrong]



    set page number style of section 1 of myDoc to triple leading zeros -- [good]

 

Regards

Re: Script who checks - and stop - if text has overset

$
0
0

Try this ...

 

var doc = app.activeDocument;
var mExitFlag = false;

var mTextFrames = doc.textFrames;
for(var i = 0; i < mTextFrames.length; i++){    if (mTextFrames[i].parentStory.overflows){        alert('Der er for meget tekst i et eller flere tekstfelte - dette skal fjernes inden du trykker SHIFT+ALT+X igen' )        mExitFlag = true;    }
}

var mLinks = doc.links;
for(var i = 0; i < mLinks.length; i++){    if (mLinks[i].status == LinkStatus.LINK_MISSING || mLinks[i].status == LinkStatus.LINK_OUT_OF_DATE){        alert('Der er links som enten mangler eller ikke er opdateret - Find eller opdatér linket inden du trykker SHIFT+ALT+X igen' );        mExitFlag = true;    }
}

if(mExitFlag){
    exit();
}

Re: Paste with formatting from word file

Re: Script who checks - and stop - if text has overset

is there an easy script to apply detect edges

$
0
0

hello

I need to apply a clipping path using detect edges with the same option on all the images in my doc

is there any script I can apply to do in bulk?

 

Thanks

Maritna

Viewing all 37788 articles
Browse latest View live


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