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

Transliteration of numbers into text

Community Beginner ,
Jun 24, 2023 Jun 24, 2023

Copy link to clipboard

Copied

Hi to all!

 

My boss asked me to transliterate for her all the numbers she writes in a certain InDesign text frame.

I tried with Find and Replace with regular expressions, and no success.

Also, I tried some scripts, but maybe I did not find a good one to do this for me.

Thank you to anyone who can do this.

 

Dumitru. 

TOPICS
How to , Scripting

Views

233
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 ,
Jun 25, 2023 Jun 25, 2023

Copy link to clipboard

Copied

Hi @dumitrus56120735 what is the transliteration? Can you post a sample document with before and after?

-Mark

Votes

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 Beginner ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

My boss wants to write a sum, e.g., 123456, and she wants to see the transliteration of it as, onehundredtwentythreethousandfourhundredfiftysix exactly like this with no break between words.

Thank you.

Votes

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 ,
Jun 25, 2023 Jun 25, 2023

Copy link to clipboard

Copied

Sounds interesting, without knowing the context of the text being captured I used some sample text and this seems to work for me.

 

quote

Imagine walking into a bustling market where vendors enthusiastically advertise their wares. A sign catches your eye: ‘Special Deal: Buy 2, Get 1 Free!’ The excitement builds as you browse through a variety of items with price tags in bold fonts, ranging from $9.99 to $99.99. As you make your way to the fruit section, you notice a vendor shouting, ‘Fresh oranges, only 3 for $2!’ Nearby, a vendor proudly displays a massive watermelon weighing a whopping 15 kilograms, while another boasts about their record-breaking pumpkin weighing in at 150 pounds. In the distance, a street performer announces, ‘Come see the incredible juggler! He can juggle up to 5 flaming torches at once!’ Your curiosity piqued, you head towards the performance area, where a crowd has gathered to witness the spectacle. The performer flawlessly juggles torches as the audience gasps in amazement. In the midst of the excitement, a young girl approaches you, selling handmade bracelets for just $5 each. You decide to support her talent and buy 2, handing her a $10 bill. With a wide smile, she thanks you, making your day even brighter.

 

 

var activeDocument = app.activeDocument;

var pasteboardTextFrame = app.activeWindow.activeSpread.pages[0].textFrames.add();
pasteboardTextFrame.geometricBounds = [0, -50, 250, 0]; // Adjust the dimensions as needed

// Define any extra text to be caputured, i.e, currency
var currencySymbols = ["\\$", "€", "£", "¥"]; // Escape the "$" symbol with "\\" to match it literally

var regexPattern = "(?:(?:" + currencySymbols.join("|") + ")\\s*)?(\\d+(?:\\.\\d+)?)";

for (var i = 0; i < activeDocument.stories.length; i++) {
  var story = activeDocument.stories[i];
  
  for (var j = 0; j < story.paragraphs.length; j++) {
    var paragraph = story.paragraphs[j];
    
    var matches = paragraph.contents.match(new RegExp(regexPattern, "g"));
    
    if (matches) {

      for (var k = 0; k < matches.length; k++) {
        var match = matches[k];
        
        pasteboardTextFrame.contents += match + "\n";
      }
    }
  }
}

 

 

Votes

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 Beginner ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

LATEST

I will check it out. I did not have time, I was working today, but I will definetly do it. Thank you very much.

Votes

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