Script to convert all text variables
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Script to convert all text variables
Tagged: text variables
- This topic has 13 replies, 2 voices, and was last updated 3 years, 1 month ago by David Blatner.
-
AuthorPosts
-
-
June 21, 2011 at 7:55 am #59907jpannierMember
Is there a script to convert all text variables in all open documents at once?
Jeldrik
-
June 25, 2011 at 9:58 am #59934tomaxxiMember
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)
-
June 25, 2011 at 11:50 am #59936Jean-Claude TremblayParticipant
Hi Marijan!
The script is good also for converting Live Captions into text since they are basically a Variable Text.
JC
-
June 25, 2011 at 11:55 am #59937tomaxxiMember
jctremblay said:
Hi Marijan!
The script is good also for converting Live Captions into text since they are basically a Variable Text.
JC
Exactly! :-)
-
June 25, 2011 at 2:15 pm #59940jpannierMember
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: https://creativepro.com/for…..n-an-epub).
Greetings from Germany
Jeldrik
-
June 27, 2011 at 12:57 am #59942jpannierMember
It works perfect – thanks again.
Jeldrik
-
July 11, 2011 at 7:18 am #60025Rhiannon MillerMember
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?
-
July 12, 2011 at 3:42 am #60029Rhiannon MillerMember
Ah, I'm being stupid again.
tell (every text variable instance of every story) to convert to text
That does it.
-
June 11, 2015 at 10:51 am #75944Liseann KarandiseckyMember
Can you help me? I am using text variables to create my running footers in a book. I created a variable that pulls from my aheads within each chapter to create my running footers. I now want to change part of the running footer. When I convert all text variables my running footer variable convert to the variable name I created, they are no longer repeating the aheads. Am I dreaming that this script can do this, or am I doing something wrong. Hope you can understand what I am trying to describe. Thanks so much. Liseann
-
August 31, 2017 at 2:37 pm #97170Asa CederholmMember
Hi there,
Trying to revive this discussion as I have the exact same problem as Liseann above. My footer text variables get converted to the variable name since they are on master pages. To get around this, I would like to make this script only apply to text variables on unlocked layers. That way I can lock my pagination layers and leave them as variables. Any ideas?
-
September 16, 2017 at 1:25 pm #98152Michel Allio for FRIdNGEParticipant
No need! simply exclude the master pages!
I’ve a script for that! … But, not for free!
(^/)
[email: [email protected]]
-
January 24, 2018 at 2:39 pm #101207Ashley CreightonMember
For the record—Obi’s script works like a charm!
I just purchased and even had him customize it (to perform on multiple documents within a folder)—it works beautifully!!!
—
Ashley
https://www.girlfromthemoon.com
-
-
February 1, 2021 at 5:16 pm #14335625BlueRiverCrossingMember
Hi guys.
I’m new to InDesign scripts.I tried to copy and paste the code and it does not work. I paste it in a plain text document changing the extension to .jsx Tried tweaking and deleting the word “try” at the beginning, the semicolon at the end and other digits but nothing works. I get an error message.
This is the code I have been using (the same that tomaxxi wrote)
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);};What am I doing wrong? Can someone link a script document so I can downloaded it please. :)
-
February 2, 2021 at 8:10 am #14335679David BlatnerKeymaster
What is the error?
One of the most common problems when copying and pasting scripts is that curly quotes often have to be changed to straight quotes. Are the quote marks straight in your code?
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.