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

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


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.

Alert Selected Table Paragraph

$
0
0

I have 5 paragraphs, when I selection the table I want to alert the paragraph item, it should be 5;

but the result is [object Paragraphs]

alert(app.selection[0].parent.paragraphs.item(0));

 

ask.jpg

How print grep search result and use it on another search

$
0
0

Hi

I wanna find a pattern and then add something to that and search it again here my code

 

app.findGrepPreferences.findWhat = "^PP[0-9]{6,6}?$";

   

    var skunumber=app.activeDocument.findGrep();

    var skupp= skunumber+"-pp"

 

 

app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;

 

app.findTextPreferences.findWhat = skupp;

 

var finds = doc.findText();

 

if (finds.length > 0) {

 

alert("Found " + finds.length + " items, the first of them is on page " + finds[0].parentTextFrames[0].parentPage.name);

}

else {

alert("Nothing has been found");

}

 

    app.changeGrepPreferences.changeTo = finds[0].parentTextFrames[0].parentPage.name; 

 

    alert(app.activeDocument.changeGrep().length); 

     

    app.activeDocument.changeGrep(); 

 

app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;

 

 

but it doesn't find the    skupp ?

how can I user the grep find value in my code?

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

Run .bat file with arguments?

$
0
0

Hi,

 

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

 

var myFile=new File("c:\\test.bat");

myFile.execute();

 

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

How to call a variable file path in javascript

$
0
0

Hi,

 

My objective is to capture a file path on mac and windows. However, this file path gets changed with various users.

 

For example the path is:

 

c:\user\username\AppData\Local\Temp\myfolder------> this is for windows machine

 

/users/username/Library/Application Support/tempfolder/Temporary Files/-------> this is for mac machine

 

As you can see, the path will be same for all the machines. Only the difference will be in searching the user and username at the start of file path. Rest folders will remain same on all the machines.

 

Is there any grep pattern through which I can call this complete path in a variable for all the users.

 

Any help will be appreciated.

 

Regards,

 

Abhi

Replace only the selected short list of words by the full definition description from a Longer list

$
0
0

Hello everybody

 

I've a selected short list from definitions book

 

And I want to add the full definitions description line to my selected definitions only

 

for example this is a small part from my selected text which I put them between this symbols @@@ and %%%:

 

@@@aedoeology%%%

@@@agriology%%%

@@@agrology%%%

@@@agronomics%%%

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

 

and this is the big list example:

 

And I put at the end of each definition description this symbols ###

 

@@@acarology%%%

study of mites###

@@@accidence%%%

grammar book; science of inflections in grammar###

@@@aceology%%%

therapeutics###

@@@acology%%%

study of medical remedies###

@@@acoustics%%%

science of sound###

@@@adenology%%%

study of glands###

@@@aedoeology%%%

science of generative organs###

@@@aerobiology%%%

study of airborne organisms###

@@@aerodonetics%%%

science or study of gliding###

@@@aerodynamics%%%

dynamics of gases; science of movement in a flow of air or gas###

@@@aerolithology%%%

study of aerolites; meteorites###

@@@aerology%%%

study of the atmosphere###

@@@aeronautics%%%

study of navigation through air or space###

@@@aerophilately%%%

collecting of air-mail stamps###

@@@aerostatics%%%

science of air pressure; art of ballooning###

@@@agonistics%%%

art and theory of prize-fighting###

@@@agriology%%%

the comparative study of primitive peoples###

@@@agrobiology%%%

study of plant nutrition; soil yields###

@@@agrology%%%

study of agricultural soils###

@@@agronomics%%%

study of productivity of land###

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

 

NOW:

 

How can I copy from the long list the full definition

 

starting from its headword and taking the full line description until the symbols ###

 

for only the selected text for my short list??????

 

Now we have:

 

First grep search:

@@@.*?%%%

 

to be replaced by:

 

second grep search:

@@@.*?%%%.*?####

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

 

Any Help I will be so thankful ....


Use actual page size in AppleScript, not document setup size.

$
0
0

Hi all,

 

Hope somebody could point me in the right direction...

 

I have a droplet app written in AppleScript. It looks for the page size of the documents dropped and uses that info. Just for testing I have a dialog at the end which returns this.

 

The problem;

The app only returns the document size, as in the size displayed in the 'Document setup' window. I need to use the actual page size, as a large number of my clients use the page tool to adjust the page sizes. I need it to always use the actual page size.

 

Has anyone run into a similar problem?

 

My code is below, thanks in advance for any help

 

 

on open mgItems

  repeat with mgThisItem in mgItems

  tell application id “com.adobe.InDesign”

  try

  open mgThisItem

 

  tell active document

 

  my get_documentSizes()

 

  tell document preferences

 

  tell document preferences

  set overallwidth to page width

  set overallHeight to page height

 

  end tell

 

  end tell

 

 

 

 

 

  end tell

 

  close active document

 

  on error

  -- decide what kind of error handling you want to include if the file won’t open

  end try

  end tell

  -- rest of script for email processing here

  end repeat

  display dialog overallwidth

end open

How to measure the space between the last line and bottom margin

$
0
0

Hi All,

 

I have 1000+ page document and now I am forced to measure the space between the last line and bottom margin of each page.

 

Is there a way to do automate it by JS?

 

I am unable to get the last line base line postion in javascript.

 

 

Please help me get this parameter

 

Merge different text boxes in InDesign one

$
0
0

Hi,

 

I have converted PDF2ID files, these files are showing different text boxes, if any scripting is there we can merge all text boxes in one box.

 

 

Thanks

Kishor

Convert an image file to Base64 or other string value

$
0
0

Hi,

I need toread the contentof an image file(JPEG, PNG,TIFF) andconvert that file toBase64string.

Does anyone know ifyou cando these thingson Javascript, in InDesign?

Thanks forany help

EDIT: I forgot toadd thatI knowmy imagepath onthe filesystem,itresidesinsideof my filesystem. I obtain that path thanks to InDesign...

script for running multiple find/change queries

$
0
0

Working on a large ID book document (*.indb), I have saved several dozens of Find/Change Queries (named "col01", "col02" etc.) that I run on "All documents". For a particular reason I have to run these queries several times a day.

 

So I was wondering whether there is, or whether anybody out there would write, a script that runs these queries one after the other. Given the size of the book, it might be necessary to provide for the script to pause after each query is run (before it goes on with the next), but I am just guessing.

 

Any help is much appreciated!

Script to target and edit page number

$
0
0

Hi everyone, I'm relatively new to scripting and am currently trying to create a script that will do the following.
Opens a dialog window with a couple of languages the user can select from then depending on the language chosen change the page numbering text frame on the master page. So if the user selects "German" for example "Page A of 1" would change to "Seite A von 1" on the A master page. I've tried using find/change but have had no success yet. Any help would be greatly appriciated

Dynamically populate InDesign file and publish

$
0
0

Greetings,

 

I have a database full of text and I would like to publish the data into a nicely designed InDesign file. I can easily dump the data into XML, JSON, or raw Text but is it possible to dynamically populate an InDesign file with this data then publish straight to PDF? Are there any examples of dyanmic data being published from an external source (like XML, JSON, etc.)?


Get textFrame's Tag/Label through script

$
0
0

Hello everyone,

 

I'm really sorry if this has already been asked, I have found discussions that touch on it, but haven't found any suggestions or solutions.

 

I am a web developer, with no inDesign experience, our graphic designer uses it to build our flyers.

We have been talking about translating the flyers to another language, and I have been working on making them interactive (with an image map)on our website.

If I'm going to suggest we revise the flyer structure for automating the translation, I'd like to also handle the image mapping (pulling image + area coordinates)

 

The thought was to write a js script that will pull the text frames from the file so I can work with them using other scripts to translate, get coordinates, etc.

 

I have more or less succeeded in doing this using the textFrame's name.
I'm currently renaming each item in the Layers window with a key-value naming structure (000-000-000|Title, 000-000-000|Description) and then splitting the name by '|' to get the product code [0] and the textFrame 'tag' [1]. Then I can run the 'tag' portion of the content through a translation script, or coordinate script as needed.

 

But there are dozens of pages with numerous products on each page, and multiple fields (title, description, price, quantity, product number) for each product.
I don't want to propose our designer meticulously rename thousands of elements.
I have found the Tags window to be much quicker to associate a type to each textFrame. But I haven't been able to work with the tags through script...

 

From what I've read, CS5 and later doesn't allow you to get a tag/label through scripting.

Is this true? Is anyone aware of any way around it?

 

 

-TLDR-

I have thousands of text (and image) elements in a InDesign file, and I would like to pull their contents out with a script and process them depending on the text field's type (product description, image, price, etc.).

Tags/Labels seem perfect, as I could just loop through all textFrame elements, and say if has tag 'description' then pass into translate(), if image getCoords().
And they are rather quick to associate with elements.

 

But from what I've read CS5 + doesn't allow you to work with tags through scripts in this way.

 

 

Any suggestions to accomplish this without working with the textFrame's names? (I'd like to avoid adding that much work to our graphic designer's monthly process)

 

If it is relevant I'm using inDesign CC 2017  V- 12.1.0.56

 

Thanks in advance for any input or direction you can provide. InDesign is not something I am familiar with :/

Run .bat file with arguments?

$
0
0

Hi,

 

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

 

var myFile=new File("c:\\test.bat");

myFile.execute();

 

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.

suspend history

$
0
0

What is the use of suspend history function. How to use the same .

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

Wait for autoflowing

$
0
0

I am using Javascript to automate Indesign CS4 and use the following line to place a text file (it is a tagged text file):

 

insertionPoint.place(File(fileToImport))

 

Everything works great as long as I have "simple" layout with few text frames per page. With a lot of text frames per page the autoflowing takes a while, and it seems my script continues to run before the autoflowing is finished. The script tries to work on text not imported yet (or not placed on the pages yet) and it stops.

 

How can I wait for the place command and autoflowing to finish, before the rest of the script is executed?

 

/Rolf

Viewing all 15932 articles
Browse latest View live


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