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.
Copy link to clipboard
Copied
Hi @dumitrus56120735 what is the transliteration? Can you post a sample document with before and after?
-Mark
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.
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.
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";
}
}
}
}
Copy link to clipboard
Copied
I will check it out. I did not have time, I was working today, but I will definetly do it. Thank you very much.