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

inDesign CS6 - changing button description ( tooltip ) using JavaScript

$
0
0

Hi,

 

I have a series of inDesign files with several interactive buttons. I need to manipulate both the NAME of the buttons, and also the DESCRIPTION of the button.

The DESCRIPTION is the PDF OPTION of the BUTTON AND FORMS pop up window from the INTERACTIVE MENU. I believe the DESCRIPTION is equivalent to  'TOOLTIP' in Acrobat.

 

So far, I have access to the NAME of the buttons by using the following in JavaScript in inDesign.

 

for (i = 0 ; i< QtyButtons;i++){

$.writeln("i= ",i,"   ",myDoc.buttons[i].name);

}

 

I could not find the proper code to access ( read ) the button DESCRIPTION.

( buttons[i].description -  buttons[i].tooltip - ... else ... )

 

Any help I could get will be greatly appreciated.


Thanks

 

 

Gervais


How to find the paragraph and line numbers [CS3] [JS]

$
0
0
Hello,

I have a script that finds certain text formatting. Rather than having the script select all the instances of this text I have an alert that lists the page number and the contents for each found instance. The following gets those.

var pageNumber = myFoundSet[n].parentTextFrames[0].parent.name;
var foundContents = myFoundSet[n].contents;

However, I would like to include the number of the paragraph where the found text resides as well as the line number in that paragraph.

I am stumped on how to do this. Would be nice if there were a parentParagraph and a parentLine.

Can someone point me in a direction?

Thanks,
Tom

Script to determine number of lines of text in a paragraph?

$
0
0

I'm revisiting an issue I first posted here last summer, thanks to all who offered help, but I've not been able to sort it out.

 

http://forums.adobe.com/thread/455526?tstart=0

 

What I'm after is  a 'search function' to insert into a FindChangeByList.

 

Jongware suggested the following - but when inserted into my list I can't get it to do anything - it doesn't throw up a Javascript error.

 

app.findTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedParagraphStyle = "Callout_3";
foundItems = app.activeDocument.findText();
for (var i=foundItems.length-1; i>=0; i--)
{
  if (foundItems[i].paragraphs[0].lines == 2)
    foundItems[i].paragraphs[0].appliedParagraphStyle = "Callout_2";
  if (foundItems[i].paragraphs[0].lines == 1)
    foundItems[i].paragraphs[0].appliedParagraphStyle = "Callout_1";
}

 

I regularly receive a 'word' document on which I run a 'FindChangeByList' which cleans up and formats the text with a number of GREP/text searches.

One of the search lines converts a particluar string of text to a paragraph style "Callout_3" (the most common occurence of Callouts).

This style applies a paragraph rule, above and below the line, to create a coloured block/band out of which said text is reveresed.

The problem that I have is that the style (because of the paragraph rules), only works correctly if the paragraph has x3 lines of text.

I have styles set up for every other eventuality - Callout_1 (for single line of text), Callout_2 (for x2 lines of text) etc.

 

What I'm looking for is a script that can count the number of lines in the paragraph (once the "Callout_3" style has been applied) and then change the style accordingly to the number of lines in each paragraph/Callout.

 

Any further thoughts?

 

Steve

Is there a script can count How many lines,and one line have how many words In a text box?

$
0
0

I have see there is a script for counting how many words in a document.

Also,Is there a script can count How many lines,and one line have how many words In a text box?

And they should be combined in a script.

Thank you~~

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

Change Text in a Text Box with Script

$
0
0

Hi,

 

I have a text box that lists the word "English" which identifies the English Manual on the title page. I copy and translate this manual. On the translated manuals, I want to change this "English" into the word "Spanish" or "Japanese" using a script. What would be the right way to do this? I could do a find change that targeted only the first page or is there some way to give a text box a unique identifier to call out in the code? Is this what "script labels" do?

Read XML file with JSX

$
0
0

I would like to be able to read an XML file in an InDesign script and create a new document by looping through its nodes and extracting content from them. I've never done this before and I can't seem to find the right information on how to do it. Can someone give me a snippet to get me started? Thanks!

document.search() is not a function

$
0
0

We recently upgraded from InDesign CS2 to InDesign CS6.

We have scripts that we ran on Windows InDesign CS2 that we are trying to get to run on a Mac InDesign CS6.

 

We are getting the following error when executing one of the scripts.

 

Screen Shot 2015-04-09 at 4.14.23 PM.png

 

 

I looked in the Object Model Viewer and did not find a method search() for Document.

 

Screen Shot 2015-04-09 at 4.06.16 PM.png

 

Since it looks like this worked before in CS2, I am wondering if anyone knows if this method was deprecated in CS6 and if there is another method that does the same work?

This is the code that gets executed.

Screen Shot 2015-04-09 at 4.06.27 PM.png

Any help in the right direction is appreciated.


Folder.getFiles Multiple Filters Mask

$
0
0

Hi all,

 

Folder.getFiles (".*") ... in this case it will get all types of files

 

Folder.getFiles (".jpg") ... in this case it will get all files with .jpg extension

 

... but how can I filter to get (for example) all files with ".jpg", " .tif" or ".eps" extension ?

 

ESTK help says: A mask string can also be the name of a function that takes a File or Folder object as its argument. It is called for each file or folder found in the search; if it returns true, the object is added to the return array.

 

Any idea of how to make such a function?

 

I will appreciate any help.

Delete Unused Paragraph Styles

$
0
0
Hi All,

I realize this one is probably pretty easy, but it has given me some grief these last few minutes. I'm trying to delete all unused paragraph styles in a document in InDesign CS. Here's the latest on what I have:

tell application "InDesign CS" to delete every unused paragraph style of document 1

I can't even get it to compile that. I've tried several variations, but all had the same result...it does not seem to like where I placed the word "unused", but I can't seem to figure out any other correct syntax.

Any help is greatly appreciated!

PDF Export - setting 'PDF Producer'

$
0
0

Hello,

 

Can anyone help me ...

 

I would like to set-up a different 'PDF Producer' in the exported PDF properties (other than Adobe PDF Library).

 

I looked at the PDFExportPreference help but I don't see that option.

 

Can it be set as metadata at the Document level? But wouldn't the pdf export overwrite it?

 

Thank you!

Cristian

exportFile() - export selection option via script?

$
0
0

Hello,

 

From InDesign, I can select a group/textFrame/pictureFrame, and then click File -> Export. From this dialog, after I select my "save location," I can then choose to "Export Selection" by selecting the "Selection" radio button.

 

I'm wondering if this is possible to do with a script? The reason I ask is because I need to export single picture frames (actually, grouped frames, there will be text frames grouped with picture frames). In the SDK I see exportFile() options where you can select if you wish to export as PDF, IDML, JPG, etc. But nothing on "exporting selection". Does anyone know if this is possible, and if so, how it is done?

 

I know there is a bool you can set to "true" to display the dialog, but this all needs to be automated. Anyone have any thoughts on this?

 

Thanks in advance!

 

-Lloyd

making the first line in each paragraph bold

$
0
0

hello all

I have been reading this forum but i cant really seem to find the answer i need.

Here is my problem, we are planning to automate the flowing of text in our organisation, this is what i have to do

-read story entries from a database

-flow the text in to a text box of particular width eg 4.5cm

-each paragraph will be sepearted by 2 new lines

- select the first line of each paragraph then make it bold.

 

from the above list i can do everything except the select first line of paragraph and make it bold. I have been looking for text selection as far as i can see there is a function called textframe.select?

Can anybody help me out with this please?

importStyles appears "open recent" file list, why?

$
0
0

Hi Everybody

 

I'm doing a script to indesign that imports object styles to my currently opened document, but to my surprise the loaded style file will appear in "open recent" file list, is there any way to avoid this ?

 

If i do it manually thru windows>styles>object styles>Load Object Styles... i will not appear in the recent files, which is why i believe it can be done.

 

the code is as follows, am i doing something wrong ?

 

var stylepath = "c:\\test_styles.indd";

app.activeDocument.importStyles(ImportFormat.OBJECT_STYLES_FORMAT, File(stylepath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);

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


.indexOf is not a function :(

$
0
0

Hi there,

 

im struggeling with this simple task:

 

var myAlphas = image.clippingPath.alphaChannelPathNames;

var AlphaIndex = myAlphas.indexOf("our_default");

 

…because even this example doesnt work:

var fruits = ["Banana", "Orange", "Apple", "Mango"];

var a = fruits.indexOf("Apple");

alert(a);

 

from JavaScript Array indexOf() Method

 

All I get is
Bildschirmfoto 2017-05-18 um 15.11.15.png
and since Im more of a designer than a scripter, i cant solve that by myslef. Someone to the rescue?

Import color values from XML or XLS

$
0
0

Hi,

 

we're designing a cloth catalog and want to import the color variants of the product from an xml or excel file. InDesign should then automatically generate colored circles from each imported color value.

Is that possible?

 

Cheers and thanks,

Daniel

metric kerning for the whole doc

$
0
0

Hi

 

I'm trying to set the Kerning for the whole doc to "Metrics";

This does not seem to do the trick:

app.activeDocument.pages.everyItem().textFrames.everyItem().contents.kerningMethod = "Metrics";

according to the scripting guide the kerningMethod seems to be a property of the contents object.

 

I guess I'm still not quite understanding the object model.

 

Any help would be appreciated.

 

Beate

Need script for find and change text

$
0
0

We have some set of texts that need to find and change in the entire InDesign CS4 document rather than doing manually. Kindly help me out to do the same successfully.

 

for e.g. find text - "mam" and replace with "man".

Find and Replace Font - Redefine styles when changing all

$
0
0

Hi,

 

     I need to enable the checkbox "Redefine Style When Changing All" in Find Font dialog.  How can I enable this check box when replacing fonts??

 

 

Screen shot 2017-09-19 at 1.34.49 PM.png

 

 

- Sudha K

Viewing all 15932 articles
Browse latest View live


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