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

Modify script for row height

New Here ,
May 07, 2009 May 07, 2009

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.
TOPICS
Scripting
1.5K
Translate
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

Deleted User
May 08, 2009 May 08, 2009

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.parent.width = .8382;

  }

regards,

sudar

Translate
Guest
May 07, 2009 May 07, 2009

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.parent.width = .33;

  }

Regards,

sudar

Translate
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
Guest
May 07, 2009 May 07, 2009

Hi,

2nd line not needed

myStyle = myDoc.paragraphStyles.item("•Price");

regards,

sudar

Translate
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
New Here ,
May 07, 2009 May 07, 2009

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.parent.width = .8382;

  }

----------------

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.

Translate
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
Advocate ,
May 07, 2009 May 07, 2009

You have "smart" quotes around "style 1" -- dumb them down.

Dave

Translate
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
New Here ,
May 07, 2009 May 07, 2009

Fixed the quotes but it is still not working. Any additional help would be great.

Translate
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
Guest
May 08, 2009 May 08, 2009

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.parent.width = .8382;

  }

regards,

sudar

Translate
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
Advocate ,
May 08, 2009 May 08, 2009

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

Translate
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
New Here ,
May 08, 2009 May 08, 2009
LATEST

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.

Translate
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