Copy link to clipboard
Copied
Hi community,
I’m trying to access the stylistic sets of a font via applescript. Unfortunately, my script is not behaving as it should. Although it works in principle. Here is the script so far:
tell application "Adobe InDesign 2022"
tell every character of selection
set OTF stylistic sets to 0
end tell
set varNum to number of characters of selection
repeat with i from 1 to varNum
tell character i of selection
set myVar to 7 -- what i actually want is: random number from 0 to 18
set OTF stylistic sets to myVar as integer
end tell
end repeat
end tell
No matter which font I use, I get the following result:
What am I doing wrong?
Copy link to clipboard
Copied
Why are you not using Paragraph and Character Styles? No script needed.
Copy link to clipboard
Copied
Because I want to randomise it in the end --> each character its won shape/stylistic set
Copy link to clipboard
Copied
Hi @BorisBlocksberg , I’m not sure I can help, but the OTF stylistic sets property is a number and not a reference to the set object or its name—there doesn’t appear to be a collection of a font’s OTF style sets in either AppleScript or Javascript.
Maybe someone else can explain what the number refers to–apparently it can be anything. So this returns 1:
tell application id "com.adobe.indesign"
set OTF stylistic sets of selection to 1
get OTF stylistic sets of selection
--returns 1
end tell
but gives me this for MinionPro:
This does not throw an error and returns 999:
tell application id "com.adobe.indesign"
set OTF stylistic sets of selection to 999
get OTF stylistic sets of selection
--returns 999
end tell
and gives me this:
Copy link to clipboard
Copied
Well, its not a solution but it brings light into the darkness. Thank you so much for testing! At least I have learned that it is not principally due to the script.