You must be logged in to post Login

Search Forums:


 






Script to convert all text variables

UserPost

7:55 am
June 21, 2011


jpannier

Bielefeld, Germany

Member

posts 54

Is there a script to convert all text variables in all open documents at once?

Jeldrik

9:58 am
June 25, 2011


tomaxxi

Subotica, Serbia

Community Member

posts 3

Post edited 9:58 am – June 25, 2011 by tomaxxi
Post edited 10:00 am – June 25, 2011 by tomaxxi
Post edited 10:01 am – June 25, 2011 by tomaxxi
Post edited 10:02 am – June 25, 2011 by tomaxxi


Hey Jeldrik,

Try this:


try{
 for(var i = 0; i < app.documents.length; i++){
  app.activeDocument.stories.everyItem().textVariableInstances.everyItem().convertToText();}
}catch(e){alert("Something gone wrong!r" + e);};


Hope that helps.

Marijan (tomaxxi)

Marijan (tomaxxi) – http://tomaxxi.com

11:50 am
June 25, 2011


jctremblay

Community Member

posts 13

Hi Marijan! 

The script is good also for converting Live Captions into text since they are basically a Variable Text.


JC

11:55 am
June 25, 2011


tomaxxi

Subotica, Serbia

Community Member

posts 3

jctremblay said:

Hi Marijan! 

The script is good also for converting Live Captions into text since they are basically a Variable Text.


JC


Exactly! :-)

Marijan (tomaxxi) – http://tomaxxi.com

2:15 pm
June 25, 2011


jpannier

Bielefeld, Germany

Member

posts 54

Thanks Marijan,

I'll test it tomorrow. I'm glad you helped me. It's an important piece in things of creating page numbers within epubs (by using a text variable pointing to an automatic generated page number by a paragraph stile and anchor it after the last character of a textframe before splitting the story and replacing all the special characters – see my post: http://indesignsecrets.com/for…..n-an-epub).


Greetings from Germany

Jeldrik

12:57 am
June 27, 2011


jpannier

Bielefeld, Germany

Member

posts 54

It works perfect – thanks again.

Jeldrik

7:18 am
July 11, 2011


orielwen

Member

posts 143

I'm trying to do something similar in Applescript, for much the same reason.  But

tell (every text variable instance) to convert to text

doesn't seem to work. I get the following:

error "Adobe InDesign CS5 got an error: every text variable instance of active document doesn’t understand the convert to text message." number -1708 from every text variable instance of active document

Yet the dictionary seems to indicate that this ought to work:

convert to text specifier : Supported by the following objects: note, footnote, text variable, text variable instance.

Any ideas?

3:42 am
July 12, 2011


orielwen

Member

posts 143

Ah, I'm being stupid again.

tell (every text variable instance of every story) to convert to text

That does it.