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

Is AppleScript broken?

Explorer ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

Catalina 10.15.7 and ID 15.1.2

All of the Applescript sample i've tried crash with errors

Simple scripts like

tell application "Adobe InDesign 2020"
set mySelection to selection
set myCharacterStyle to character style "Italics"
set applied character style of item 1 of mySelection to myCharacterStyle of active document
end tell
 
crash with error message
Invalid key form
on 
character style "Italics"
TOPICS
Scripting

Views

200

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
Community Expert ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

Two of the lines in your code return errors. Try this:

 

tell application id "com.adobe.indesign"
	set mySelection to selection
	
	--set myCharacterStyle to character style "Italics" 
	--error: Can’t get character style \"Italics\"." 
	
	set myCharacterStyle to (every character style of active document whose name is "Italics")
	
	--set applied character style of item 1 of mySelection to myCharacterStyle of active document
	--error "Adobe InDesign 2020 got an error: Invalid value for set property 'applied character style'. Expected character style or string, but received nothing."
	
	set applied character style of item 1 of mySelection to item 1 of myCharacterStyle
end tell

Votes

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
Explorer ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

this gives an error:
Expected “from”, etc. but found property.
on the word "style" in 

(every character style of active document whose name is "Italics")

Votes

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
Community Expert ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

You can also use object reference, this should work:

 

tell application id "com.adobe.indesign"
	set mySelection to selection
	set myCharacterStyle to object reference of character style "Italics" of active document
	set applied character style of item 1 of mySelection to myCharacterStyle
end tell

Votes

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
Explorer ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

this gives an error:
Expected end of line, etc. but found “reference”.

Votes

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
Community Expert ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

There do seem to be many problems with AS on Catalina—can’t help I’m using High Sierra. The script in your first post does not compile on HS (my examples do). There aren’t many AS scripters here, so you might check at macscripter

 

https://macscripter.net/

Votes

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
Explorer ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

LATEST

thanks for trying

Votes

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