6 Replies Latest reply on Sep 15, 2008 10:16 AM by (Olav_Kvern)

    CS3. Doesn't work FitContentToFrame in TextFrame

    Level 1
      Hi.

      I develop some script with support COM interface.

      I create new TextFrame and set some text. After that I execute function Fit(from TextFrame object) with parameter idContentToFrame. It not work. But, if I execute the same function with parameter idFrameToContent it excellent work.

      Please, help me.

      Thanks.
        • 1. Re: CS3. Doesn't work FitContentToFrame in TextFrame
          Level 1
          Have you checked the user interface? It doesn't work there either. That feature is not part of the product. You would have to write a script to do whatever you have in mind for the content.

          Dave
          • 2. Re: CS3. Doesn't work FitContentToFrame in TextFrame
            Level 1
            Thank you Dave.

            I saw, in user interface it option is disabled, but I was think maybe I not correct set some other options for text frame, and got disable menu.

            I downloaded some script from adobe.com site for execute this operations. But it is in some hex code, like this:

            eval(unescape("%69%66%20%28%61%70%70%2E%64%6F%63%75%6D%65%6E%74%73%2E%6C%65%6E%67%74%68%20 %21%3D%20%30%29%7B%0A%09%69%66%20%28%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%2E%6C%65%6E%67 %74%68%20%3D%3D%20%31%29%7B%0A%09%09%73%77%69%74%63%68%20%28%61%70%70%2E%73%65%6C%65%63%74 %69%6F%6E%5B%30%5D%2E%63%6F%6E%73%74%72%75%63%74%6F%72%2E%6E%61%6D%65%29%7B%0A%09%09%09%63 %61%73%65%20%22%54%65%78%74%22%3A%0A%09%09%09%09%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D %65%20%3D%20%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%5B%30%5D%2E%69%6E%73%65%72%74%69%6F%6E %50%6F%69%6E%74%73%5B%30%5D%2E%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65%3B%0A%09%09%09 %09%73%74%6F%72%79%20%3D%20%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%5B%30%5D%2E%70%61%72%65 %6E%74%53%74%6F%72%79%3B%0A%09%09%09%09%62%72%65%61%6B%3B%0A%09%09%09%63%61%73%65%20%22%49 %6E%73%65%72%74%69%6F%6E%50%6F%69%6E%74%22%3A%0A%09%09%09%09%70%61%72%65%6E%74%54%65%78%74 %46%72%61%6D%65%20%3D%20%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%5B%30%5D%2E%70%61%72%65%6E %74%54%65%78%74%46%72%61%6D%65%3B%0A%09%09%09%09%73%74%6F%72%79%20%3D%20%61%70%70%2E%73%65 %6C%65%63%74%69%6F%6E%5B%30%5D%2E%70%61%72%65%6E%74%53%74%6F%72%79%3B%0A%09%09%09%09%69%66 %28%73%74%6F%72%79%2E%69%6E%73%65%72%74%69%6F%6E%50%6F%69%6E%74%73%2E%6C%65%6E%67%74%68%3C %32%29%20%65%72%72%28%22%53%65%6C%65%63%74%20%61%20%74%65%78%74%20%66%72%61%6D%65%20%77%69 %74%68%20%74%65%78%74%2E%22%29%3B%0A%09%09%09%09%62%72%65%61%6B%3B%0A%09%09%09%63%61%73%65 %20%22%54%65%78%74%46%72%61%6D%65%22%3A%0A%09%09%09%09%70%61%72%65%6E%74%54%65%78%74%46%72 %61%6D%65%20%3D%20%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%5B%30%5D%3B%0A%09%09%09%09%69%66 %28%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65%2E%63%6F%6E%74%65%6E%74%73%20%3D%3D%20%22 %22%29%7B%0A%09%09%09%09%09%77%68%69%6C%65%28%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65 %2E%70%72%65%76%69%6F%75%73%54%65%78%74%46%72%61%6D%65%29%7B%0A%09%09%09%09%09%09%70%61%72 %65%6E%74%54%65%78%74%46%72%61%6D%65%20%3D%20%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65 %2E%70%72%65%76%69%6F%75%73%54%65%78%74%46%72%61%6D%65%0A%09%09%09%09%09%09%69%66%28%70%61 %72%65%6E%74%54%65%78%74%46%72%61%6D%65%2E%63%6F%6E%74%65%6E%74%73%20%3D%3D%20%22%22%29%7B %20%62%72%65%61%6B%3B%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%09%69%66%20%28%70%61%72%65%6E %74%54%65%78%74%46%72%61%6D%65%2E%63%6F%6E%74%65%6E%74%73%20%3D%3D%20%22%22%29%7B%65%72%72 %28%22%54%65%78%74%20%6D%75%73%74%20%62%65%20%70%72%65%73%65%6E%74%2E%22%29%3B%7D%0A%09%09 %09%09%7D%0A%09%09%09%09%73%74%6F%72%79%20%3D%20%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D %65%2E%74%65%78%74%73%5B%30%5D%2E%70%61%72%65%6E%74%53%74%6F%72%79%3B%0A%09%09%09%09%62%72 %65%61%6B%3B%0A%09%09%09%64%65%66%61%75%6C%74%3A%0A%09%09%09%09%65%72%72%28%22%53%65%6C%65 %63%74%20%61%20%74%65%78%74%20%66%72%61%6D%65%20%6F%72%20%73%6F%6D%65%20%74%65%78%74%2E%22 %29%3B%0A%09%09%09%09%62%72%65%61%6B%3B%0A%09%09%7D%0A%09%7D%0A%09%65%6C%73%65%7B%0A%09%09 %65%72%72%28%22%53%65%6C%65%63%74%20%61%20%74%65%78%74%20%66%72%61%6D%65%20%6F%72%20%73%6F %6D%65%20%74%65%78%74%2E%22%29%3B%0A%09%7D%0A%7D%0A%65%6C%73%65%7B%0A%09%65%72%72%28%22%4E %6F%20%64%6F%63%75%6D%65%6E%74%73%20%61%72%65%20%6F%70%65%6E%2E%20%50%6C%65%61%73%65%20%6F %70%65%6E%20%61%20%64%6F%63%75%6D%65%6E%74%2C%20%73%65%6C%65%63%74%20%73%6F%6D%65%20%74%65 %78%74%2C%20%61%6E%64%20%74%72%79%20%61%67%61%69%6E%2E%22%29%3B%0A%7D%0A%0A%73%74%6F%72%79 %2E%74%65%78%74%73%2E%65%76%65%72%79%49%74%65%6D%28%29%2E%73%65%6C%65%63%74%28%29%3B%0A%61 %70%70%2E%63%6F%70%79%28%29%3B%0A%61%70%70%2E%73%65%6C%65%63%74%69%6F%6E%20%3D%20%6E%75%6C %6C%3B%0A%0A%6C%65%61%64%69%6E%67%20%3D%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%6C %65%61%64%69%6E%67%3B%0A%0A%0A%69%66%28%6C%65%61%64%69%6E%67%20%3D%3D%22%61%75%74%6F%22%29 %7B%0A%09%6C%65%61%64%69%6E%67%50%65%72%63%65%6E%74%20%3D%20%30%3B%0A%7D%20%65%6C%73%65%20 %7B%0A%09%6C%65%61%64%69%6E%67%50%65%72%63%65%6E%74%20%3D%20%6C%65%61%64%69%6E%67%20%2F%73 %74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%3B%0A%7D%0A%0A%2F%2F %66%69%72%73%74%20%63%68%65%63%6B%20%66%6F%72%20%6F%76%65%72%66%6C%6F%77%73%0A%77%68%69%6C %65%20%28%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65%2E%6F%76%65%72%66%6C%6F%77%73%20%3D %3D%20%74%72%75%65%29%7B%0A%09%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74 %53%69%7A%65%20%2A%3D%20%30%2E%35%3B%0A%09%69%66%20%28%6C%65%61%64%69%6E%67%20%21%3D%20%30 %29%7B%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%6C%65%61%64%69%6E%67%20%3D%20%20%73 %74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%2A%6C%65%61%64%69%6E %67%50%65%72%63%65%6E%74%7D%3B%0A%09%2F%2F%69%66%20%28%73%74%6F%72%79%2E%74%65%78%74%73%5B %30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%3C%3D%30%2E%31%29%7B%0A%09%09%2F%2F%65%72%72%28%22 %54%68%69%73%20%77%69%6C%6C%20%72%65%73%75%6C%74%20%69%6E%20%74%65%78%74%20%74%68%61%74%20 %69%73%20%6C%65%73%73%20%74%68%61%6E%20%30%2E%31%20%70%74%21%22%29%3B%0A%09%2F%2F%09%7D%0A %7D%0A%70%6F%69%6E%74%53%69%7A%65%31%20%3D%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E %70%6F%69%6E%74%53%69%7A%65%3B%0A%0A%77%68%69%6C%65%20%28%70%61%72%65%6E%74%54%65%78%74%46 %72%61%6D%65%2E%6F%76%65%72%66%6C%6F%77%73%20%3D%3D%20%66%61%6C%73%65%29%7B%0A%09%73%74%6F %72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%2A%3D%20%32%3B%0A%09%69 %66%20%28%6C%65%61%64%69%6E%67%20%21%3D%20%30%29%7B%20%73%74%6F%72%79%2E%74%65%78%74%73%5B %30%5D%2E%6C%65%61%64%69%6E%67%20%3D%20%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70 %6F%69%6E%74%53%69%7A%65%2A%6C%65%61%64%69%6E%67%50%65%72%63%65%6E%74%7D%3B%0A%09%2F%2F%69 %66%20%28%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%3E%32 %30%30%29%7B%0A%09%09%2F%2F%65%72%72%28%22%54%68%69%73%20%77%69%6C%6C%20%72%65%73%75%6C%74 %20%69%6E%20%74%65%78%74%20%74%68%61%74%20%69%73%20%6D%6F%72%65%20%74%68%61%6E%20%32%30%30 %20%70%74%21%22%29%3B%0A%09%2F%2F%09%7D%0A%7D%0A%70%6F%69%6E%74%53%69%7A%65%32%20%3D%20%70 %6F%69%6E%74%53%69%7A%65%20%3D%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E %74%53%69%7A%65%3B%0A%64%69%76%69%64%65%72%20%3D%20%70%6F%69%6E%74%53%69%7A%65%32%20%2D%20 %70%6F%69%6E%74%53%69%7A%65%31%3B%0A%77%68%69%6C%65%20%28%31%29%7B%0A%09%69%66%20%28%64%69 %76%69%64%65%72%20%3C%20%30%2E%30%31%29%7B%62%72%65%61%6B%3B%7D%0A%09%69%66%20%28%21%70%61 %72%65%6E%74%54%65%78%74%46%72%61%6D%65%2E%6F%76%65%72%66%6C%6F%77%73%29%7B%0A%09%09%70%6F %69%6E%74%53%69%7A%65%20%3D%20%70%6F%69%6E%74%53%69%7A%65%20%2B%3D%20%64%69%76%69%64%65%72 %0A%09%09%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%3D%20 %70%6F%69%6E%74%53%69%7A%65%3B%0A%09%09%64%69%76%69%64%65%72%20%3D%20%64%69%76%69%64%65%72 %2F%32%3B%0A%09%7D%20%65%6C%73%65%20%7B%0A%09%09%70%6F%69%6E%74%53%69%7A%65%20%3D%20%70%6F %69%6E%74%53%69%7A%65%20%2D%3D%20%64%69%76%69%64%65%72%0A%09%09%73%74%6F%72%79%2E%74%65%78 %74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%3D%20%70%6F%69%6E%74%53%69%7A%65%3B%0A%09 %09%64%69%76%69%64%65%72%20%3D%20%64%69%76%69%64%65%72%2F%32%3B%0A%09%7D%0A%09%69%66%20%28 %6C%65%61%64%69%6E%67%20%21%3D%20%30%29%7B%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E %6C%65%61%64%69%6E%67%20%3D%20%20%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E %74%53%69%7A%65%2A%6C%65%61%64%69%6E%67%50%65%72%63%65%6E%74%7D%3B%0A%7D%0A%0A%77%68%69%6C %65%20%28%70%61%72%65%6E%74%54%65%78%74%46%72%61%6D%65%2E%6F%76%65%72%66%6C%6F%77%73%29%7B %0A%09%73%74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%20%2D%3D%20 %64%69%76%69%64%65%72%3B%0A%09%69%66%20%28%6C%65%61%64%69%6E%67%20%21%3D%20%30%29%7B%20%73 %74%6F%72%79%2E%74%65%78%74%73%5B%30%5D%2E%6C%65%61%64%69%6E%67%20%3D%20%20%73%74%6F%72%79 %2E%74%65%78%74%73%5B%30%5D%2E%70%6F%69%6E%74%53%69%7A%65%2A%6C%65%61%64%69%6E%67%50%65%72 %63%65%6E%74%7D%3B%0A%7D%0A%0A%0A%0A%64%69%73%70%6C%61%79%44%69%61%
            • 3. Re: CS3. Doesn't work FitContentToFrame in TextFrame
              Level 1
              Hi Pier,

              This is what I use to fit text to a fixed sized frame:

              function resizeContentWhenOverset() {
              var myDoc = app.activeDocument;
              var myStories = myDoc.stories;
              var myText = myDoc.paragraphStyles.item("myParaStyle");
              for (var j = myStories.length - 1; j >= 0; j--) {
              while (myStories[j].overflows == true) {
              if (myStories[j].appliedParagraphStyle == myText) {
              myText.minimumGlyphScaling = myText.minimumGlyphScaling - 1;
              myText.desiredGlyphScaling = myText.desiredGlyphScaling - 1;
              myText.minimumWordSpacing = myText.minimumWordSpacing - 0.1;
              myText.desiredWordSpacing = myText.desiredWordSpacing - 0.1;
              myText.minimumLetterSpacing = myText.minimumLetterSpacing - 0.725;
              myText.desiredLetterSpacing = myText.desiredLetterSpacing - 0.725;
              if (myText.desiredGlyphScaling < 60) {
              myText.minimumGlyphScaling = 50;
              myText.desiredGlyphScaling = 50;
              myText.minimumWordSpacing = 75;
              myText.desiredWordSpacing = 75;
              break;
              }}}}}

              What this does is reduces the Glyph, Letter and Word spacing by icrements until it fits when the para style = myParaStyle. If the Glyph scaling gets below 60% then I just set everything to the minimum because you can't go below 50% and it will crash the script. This works well for my situation where the text box cannot expand and the text must reduce to fit.

              I hope this helps.

              Brett
              • 4. Re: CS3. Doesn't work FitContentToFrame in TextFrame
                Level 1
                Brett, thank you very much, this is thing, what I search.
                • 5. Re: CS3. Doesn't work FitContentToFrame in TextFrame
                  Just looking for an excuse to show off my new script "Fit Story to Text Frame" located in the exchange. Has very detailed user interface. I would like to know if it's working or any bugs. thanks
                  http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=1657 519
                  • 6. Re: CS3. Doesn't work FitContentToFrame in TextFrame
                    Level 1
                    Hi Pier,

                    Does "Fit Content to Frame" appear on the Fitting submenu in the user interface when you have text or a text frame selected? No, it doesn't. So scripting can't do it either.

                    Thanks,

                    Ole