Accessing OTF stylistic sets vis applescript

New Here ,
Mar 07, 2022 Mar 07, 2022

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: 

Bildschirmfoto 2022-03-07 um 20.11.00.png

What am I doing wrong?

TOPICS
Scripting , Type

Views

102

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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
New Here ,
Mar 07, 2022 Mar 07, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 08, 2022 Mar 08, 2022

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:

 

Screen Shot 32.png

 

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:

 

Screen Shot 33.png

Likes

Translate

Translate

Report

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
New Here ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

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