Setting font by variable not working in Illustrator

G’day

Using Illustrator CC, with El Capitan.

I’d like to use a global variable to set and use a barcode font, but when doing so in Illustrator, I get an error -1503, ‘Apple Event contained an unknown absolute position form’.

I’ve tried all sorts of code variations, including setting my variable just before using it. Using a variable works in vanilla Applescript, but not in ASObjC!


# The top three don't work.
#set barCodeFont to text font "IDAutomationHC39M"
# set the text font of text range of text frame "AreaTextThree" of document 1 to text font barCodeFont
# set the text font of text range of text frame "AreaTextThree" of document 1 to barCodeFont
#
# This direct use does! Bit of a bummer.
set the text font of text range of text frame "AreaTextThree" of document 1 to text font "IDAutomationHC39M"
		

Does anyone know of a way of using a variable to set the text font, please? Or is it impossible?

Regards

Santa

EDIT: Just tested, and this applies to the whole Adobe CC suit except Acrobat; just Illustrator, Indesign. It’s a real pain.

Model: late 2014 i7 iMac
AppleScript: 2.8.1
Browser: Safari 601.4.4
Operating System: Mac OS X (10.10)

Hi Santa

Just an idea.



set barCodeFont to "IDAutomationHC39M" -- removed the words text font
set the text font of text range of text frame "AreaTextThree" of document 1 to text font barCodeFont


Not sure if this may be relevant but I came across your post because of the error message. It turned out the reason I was getting my error was because I made a handler and forgot to put the same amount of variables in the handler as the instance of it in the script. Normally if I did something silly like that I would get a message about a variable not being defined, so this confused me for a while.