Copy link to clipboard
Copied
Hi this works kinda. I want the Find and replace to work with the Text Frames that i have selected only. And if possible to get the Resize text part to only resize one time. Right now if i keep clicking the Script it keeps shrinking the text and i only want it to fit 1 time. Then after its done maybe say "Text alredy Formatted" Also i'm not sure if i did the description right. I want it to tell what the script is when hover over it with my mouse. Any help will be appreciated.
//DESCRIPTION: Replace <CR> with Hard return/Resize Font to fit text frame
//Replaces("<CR>", "Hard Return")
Replace(" <CR> ", "^p")
function Replace(input, output)
{
app.selection[0];
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = input;
app.changeTextPreferences.changeTo = output;
app.activeDocument.changeText();
}
var myTextFrame = app.selection[0];
var myText = myTextFrame.parentStory.texts[0];
do {
myText.pointSize = myText.pointSize - .01;
} while (myTextFrame.overflows == true);
use this
...Replace(" <CR> ", "^p")
function Replace(input, output)
{
app.selection[0];
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = input;
app.changeTextPreferences.changeTo = output;
app.activeDocument.changeText();
}
var myTextFrame = app.selection[0];
var myText = myTextFrame.parentStory.texts[0];
try{
do {
myText.pointSize = myText.pointSize - .01;
Copy link to clipboard
Copied
use this
Replace(" <CR> ", "^p")
function Replace(input, output)
{
app.selection[0];
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = input;
app.changeTextPreferences.changeTo = output;
app.activeDocument.changeText();
}
var myTextFrame = app.selection[0];
var myText = myTextFrame.parentStory.texts[0];
try{
do {
myText.pointSize = myText.pointSize - .01;
} while (myTextFrame.overflows == true);
}
catch(e){
alert("Text already Formatted")
}
Copy link to clipboard
Copied
This did the same thing the one i pasted above. I'm wanting it to resize the selected Text Frames. Usually just 2 or 3 text frames is all that needs resized. Also Both texts only shrink text size. Is there a way to tell it to Fill the text frame by both Shrinking and expanding by .01? Some text in the frames i'm using Will need a bigger font size inorder to fill the frame. And the alert does not show up when i hit it a second time.
Copy link to clipboard
Copied
NM i had to restart Indesign it is working fine. but my other questions still apply.. Thank you..
Copy link to clipboard
Copied
Two things if you permit:
1) find/change operations can be easily applied to a text frame object:
myTextFrame.changeGrep()…
2) for fixing overrides see this thread:
https://forums.adobe.com/inbox
or here:
Indiscripts :: On Dichotomic Divide-and-Conquer Algorithms
FWIW
Loic
Find more inspiration, events, and resources on the new Adobe Community
Explore Now