• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
8

Way to use Find to locate a specific text variable?

Engaged ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

Hi. Using ID 19.0.1 with Win 11/updated.

I've used a text variable for the product name: "use a <Vapid-20> thingie to...." Why? The client likes to change the names of things mid-project.

But they got me this time. They changed it to a name beginning with a vowel. Now it's the <Avapid-20>. I can instantly change the product name everywhere by editing the variable, but everywhere I said "use a Vapid-20" it now has to be "use an Avapid-20." English.

Is there any way to search/find a text variable? 

I suppose I could then use GREP or even scripting to change the word just before it if needed... but I have to find it first.

As always, thanks to the community.

-j

TOPICS
How to , Scripting

Views

833

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Nov 27, 2023 Nov 27, 2023

You can find search the text variable. you just click on the @ drop down next to the text field and insert the correct special character for your variable. The problem is that you can not replace with a text variable. So either you would have to replace your text variable with the actual text for the name, or you would need to just search and manually adjust the article.

Votes

Translate

Translate
Engaged ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

You can find search the text variable. you just click on the @ drop down next to the text field and insert the correct special character for your variable. The problem is that you can not replace with a text variable. So either you would have to replace your text variable with the actual text for the name, or you would need to just search and manually adjust the article.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

This is a 98% solution -- thanks. I did not know this existed. I'm using several custom-text variables, and this finds them all... but it's better than searching for the letter "a." 🙂

-j

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

You could get 100% with Robert's suggestion of checking the textVariableInstances for the correct variable and then checking in the parent text object of the correct variable for an " a " at it's index-3. then you would have to insert the "n" at it's index-1 of the parent text object.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

quote

You could get 100% with Robert's suggestion of checking the textVariableInstances for the correct variable and then checking in the parent text object of the correct variable for an " a " at it's index-3. then you would have to insert the "n" at it's index-1 of the parent text object.


By @John D Herzog

 

I don't think it will work that way ...

 

Variable is an object - kind of InLine TextFrame - and you can't just refer to its name like it is a part of the main text:

 

RobertTkaczyk_2-1701126805094.png

 

Green marked "AAAAA" is a Text Variable - and it is a single Character.

 

Also, you can't refer to it by its index as this is a location in the TextVariableInstances collection - you would have to refer to it as a StoryOffset - which is an InsertionPoint:

 

RobertTkaczyk_1-1701126738543.png

 

And next Character would be a "location" of the Variable...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

And here is more detailed view - by Characters:

RobertTkaczyk_0-1701127179105.png

or by Words:

RobertTkaczyk_0-1701129002659.png

 

It's always a single Character.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

Sorry. I overgeneralized. I will spell it out better without getting into the complete coding of the problem.

Find the your textVariable in the array of textVariables for the document.

Take the associatedInstances (another array) of your textVariable and check in their parent before their storyOffset.index for " a ".

if the " a " is found place an "n" after the "a" in the " a ".

You could go a step further and check the associatedInstances.resultText for a vowel or consonant at the begining. Depending on the answer adjusting to an "a" or "an" as needed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

OK, I've misunderstood OP's post - and now your answer @John D Herzog makes sense.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 27, 2023 Nov 27, 2023

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2023 Nov 28, 2023

Copy link to clipboard

Copied

Maybe a different approach - a bit simpler and more bullet proof solution - two variables? 

 

One, when product's name is "alone" - like in the title. 

 

Another - when in text - so you can add "a" or "an" as part of the variable's content? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

LATEST

Was thinking about that as well. We just don't know how many text variables they are already juggling. We know it is more than just the product name. If they have a lot of them, a simple script that checks the first letter of all their variables might cause less headaches.

 

Anyway this is all theoretical since I think the OP is done with this topic.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines