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

Find Format, Font Style, Character Style, Find and Change,,, Javascript or Applescript

Explorer ,
Aug 17, 2012 Aug 17, 2012

I'm trying my first whoop at a script and I am in dire need of some help. I've downloaded all kinds of example, however most are too elaborate.

Here's what I'm trying to do:

A Find/Change, then Find Format (Basic Character Formats; Font Style "Italic")

Then

Change Format (Character Style; "my style")

I've tried to create this in Applescript and in ExtendScriptToolkit.

Yesterday I read Adobes Script intro PDF.... Now, I don't know if I'm more confused or understanding what's going on.

Here's my attempt—

{

                cstyle = app.activeDocument.characterStyles.add({name:simple_italic});

                if (italic) cstyle.fontStyle = app.findTextPreferences.fontStyle;

            }

        }

        app.changeTextPreferences.appliedCharacterStyle = simple_italic;

        app.activeDocument.selection[0].parent.changeText (false);

    }

Is this even close?

Thanks, T—

Screen Shot 2012-08-17 at 1.12.14 AM.png

Screen Shot 2012-08-17 at 1.11.05 AM.png

Screen Shot 2012-08-17 at 1.11.43 AM.png

TOPICS
Scripting
932
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

Explorer , Aug 17, 2012 Aug 17, 2012

I found my own answer... Thanks guys!

{

        if (StyleName == "")

        {

        //    Make up a name

            if (bold)

                StyleName = "simple_bold";

            if (italic)

            {

                if (bold)

                    StyleName = "simple_bold_italic";

                else

                    StyleName = "simple_italic";

            }

Translate
Explorer ,
Aug 17, 2012 Aug 17, 2012

Actually, Jongware's PrepText works!

However, it adds Character Styles....

Which I really don't want. I've tried to edit the script using my (simple_bold, simple_italic etc.) Character Styles, no luck.

This is Jongware's script:

http://www.jongware.com/binaries/preptext.zip

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
Explorer ,
Aug 17, 2012 Aug 17, 2012
LATEST

I found my own answer... Thanks guys!

{

        if (StyleName == "")

        {

        //    Make up a name

            if (bold)

                StyleName = "simple_bold";

            if (italic)

            {

                if (bold)

                    StyleName = "simple_bold_italic";

                else

                    StyleName = "simple_italic";

            }

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