Wednesday, December 13, 2017

#1 2016-02-12 05:40:27 pm

Santa
Member
From:: Land of Oz
Registered: 2006-07-27
Posts: 486

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!

Applescript:


# 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)

Last edited by Santa (2016-02-12 07:06:40 pm)


Just an enthusiastic old fart of an Apple user since the IIe days

Offline

 

#2 2016-03-05 11:09:23 pm

divster
Member
Registered: 2011-03-01
Posts: 112

Re: Setting font by variable not working in Illustrator

Hi Santa

Just an idea…

Applescript:



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.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)