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

Accessing OTF stylistic sets vis applescript

Community Beginner ,
Mar 07, 2022 Mar 07, 2022

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
317
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
Community Expert ,
Mar 07, 2022 Mar 07, 2022

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

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

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

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
Community Expert ,
Mar 08, 2022 Mar 08, 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:

 

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

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
Community Beginner ,
Mar 10, 2022 Mar 10, 2022
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.

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