Copy link to clipboard
Copied
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
Have something to add?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more