Script to convert all text variables

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Script to convert all text variables

Viewing 10 reply threads
  • Author
    Posts
    • #59907
      jpannier
      Member

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

      Jeldrik

    • #59934
      tomaxxi
      Member

      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)

    • #59936

      Hi Marijan!

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

      JC

    • #59937
      tomaxxi
      Member

      jctremblay said:

      Hi Marijan!

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

      JC


      Exactly! :-)

    • #59940
      jpannier
      Member

      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&#8230;..n-an-epub).

      Greetings from Germany

      Jeldrik

    • #59942
      jpannier
      Member

      It works perfect – thanks again.

      Jeldrik

    • #60025

      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?

    • #60029

      Ah, I'm being stupid again.

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

      That does it.

    • #75944

      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

    • #97170
      Asa Cederholm
      Participant

      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?

    • #98152

      No need! simply exclude the master pages!

      I’ve a script for that! … But, not for free!

      (^/)

      [email: obiwankenobiearth@gmail.com]

      • #101207
        Ashley Creighton
        Participant

        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
        http://www.girlfromthemoon.com

Viewing 10 reply threads
  • You must be logged in to reply to this topic.
>