Skip to main content
Participating Frequently
March 7, 2022
Question

Accessing OTF stylistic sets vis applescript

  • March 7, 2022
  • 2 replies
  • 344 views

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?

This topic has been closed for replies.

2 replies

rob day
Community Expert
Community Expert
March 8, 2022

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:

 

Participating Frequently
March 10, 2022

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.

Willi Adelberger
Community Expert
Community Expert
March 7, 2022

Why are you not using Paragraph and Character Styles? No script needed.

Participating Frequently
March 8, 2022

Because I want to randomise it in the end --> each character its won shape/stylistic set