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

Toggle italic in script

New Here ,
Apr 09, 2018 Apr 09, 2018

Hi -

I'm making a js-script where I need to toggle italics on the selected text. I am using character-styles, but need a fallback when the character-style doesn't exist.

I am doing something like:

app.activeDocument.doc.selection[0].fontStyle = "Italic"

....

app.activeDocument.doc.selection[0].fontStyle = "Normal"

This works fine most of the time, but not with fonts with italic fontnames like "56 italic", "oblique" etc.

The keyboard-shortcut ctrl+shift+I is smarter, and find the right "italic-name".

How can I access the functionality of the keyboard-shortcut in my script?

Best regards

Johannes

Edit: I found a soulution: [JS CS3] Apply Italics with scripting

TOPICS
Scripting
271
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
no replies

Have something to add?

Join the conversation