Copy link to clipboard
Copied
Years ago, I was given this script:
myDoc = app.activeDocument;
myStyle = myDoc.paragraphStyles.item("•Price");
app.findPreferences = null;
app.changePreferences = null;
myParas = myDoc.search("",false,false,undefined,{appliedParagraphStyle:myStyle});
for (var j = myParas.length - 1; j >= 0; j--) {
myParas.parent.width = .33;
}
Does anyone know how to modify this so I can change row heights to specific atleast heights in my table based on character styles? I only have three character styles. All three would have a different height. Using CS3. Thank you.
In CS3 / Windows / Javascript
Without any errors, the following code fine,
myDoc = app.activeDocument;
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle=myDoc.characterStyles.item("style 1");
myParas = myDoc.findText();
for (var j = myParas.length - 1; j >= 0; j--) {
myParas
}
regards,
sudar
Copy link to clipboard
Copied
Hi,
Im just modifying your script according to CS3, that it!!!!!
myDoc = app.activeDocument;
myStyle = myDoc.paragraphStyles.item("•Price");
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle=myDoc.characterStyles.item("cell");
myParas = myDoc.findText();
for (var j = myParas.length - 1; j >= 0; j--) {
myParas
}
Regards,
sudar
Copy link to clipboard
Copied
Hi,
2nd line not needed
myStyle = myDoc.paragraphStyles.item("•Price");
regards,
sudar
Copy link to clipboard
Copied
I used your suggestion to try to achieve the results I was looking for but ran into trouble. I don't know scripting but thought I could figure it out by your suggestion. I altered it this way:
---------------
myDoc = app.activeDocument;
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle=myDoc.characterStyles.item(“style1”);
myParas = myDoc.findText();
for (var j = myParas.length - 1; j >= 0; j--) {
myParas
}
----------------
I put this in script editor and it return an error of "Syntax error. Expected expression, property or key form, etc. but found unknown token."
I was trying to use my "style1" Charater style and assign a height of .8382". For one, it isn't a width but a height. So, I think I did that wrong. And since there is only one table maybe I don't need the "width" at all. Is the "myParas.length actually the height. Next, in the syntax error highlighted the "." in the first line and returned the error.
Sorry I don't really know what to do.
Copy link to clipboard
Copied
You have "smart" quotes around "style 1" -- dumb them down.
Dave
Copy link to clipboard
Copied
Fixed the quotes but it is still not working. Any additional help would be great.
Copy link to clipboard
Copied
In CS3 / Windows / Javascript
Without any errors, the following code fine,
myDoc = app.activeDocument;
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle=myDoc.characterStyles.item("style 1");
myParas = myDoc.findText();
for (var j = myParas.length - 1; j >= 0; j--) {
myParas
}
regards,
sudar
Copy link to clipboard
Copied
What state are your findChange options? You're not addressing them and they can really screw up a search.
I use this to set up a find change:
function setupFindText(find, change, wholeWd, caseSense, foots, hidLayers, lockedLayers, lockedStories, masters) {
app.findTextPreferences = null;
app.changeTextPreferences = null;
try { app.findTextPreferences.findWhat = find } catch(e) {};
try {app.changeTextPreferences.changeTo = change } catch(e) {};
app.findChangeTextOptions.properties = {
caseSensitive:(caseSense == null ? false : caseSense),
wholeWord:(wholeWd == null ? false : wholeWd),
includeFootnotes:(foots == null ? false : foots),
includeHiddenLayers:(hidLayers == null ? false : hidLayers),
includeLockedLayersForFind:(lockedLayers == null ? false : lockedLayers),
includeLockedStoriesForFind:(lockedStories == null ? false : lockedStories),
includeMasterPages:(masters == null ? false : masters)
}
} // end setupFindText
Dave
Copy link to clipboard
Copied
Not sure what you mean since I don't know much about scripting. What I intended to do was find all instances of "cell style 2" in the cell style option. Finding this would give me the row that the height (not the width in my sample script) and then change that to a row height of .0417. I thought I could just adjust the script that I had to make these changes but I think this is more difficult than I expected--for me.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more