Scripting Extensis Universal Type Client

Has anyone here done any scripting for UTC? There’s no AS dictionary for the application, but I found some documentation from 2016 here. It says you can use AppleScript or other scripting languages, but I’m coming up dry on examples of how to use the commands.

I can get the following to run in Terminal:

 corecli -clientserver -getFontDataByIDs Font-IDs=123

… but if I try to run it using AppleScript:

 do shell script "corecli -clientserver -getFontDataByIDs Font-IDs=123"

it errors saying “sh: corecli: command not found”.

I don’t have a ton of experience using shell script and I’m sure I’m doing something dumb. Anybody have any idea what dumb thing I’m doing?

Thanks!

The shell used in do shell script does not use the same configuration that the terminal does.

If you run env in each environment, you will see numerous differences but especially in the path. It is likely that this corecli is not in the path which means that you will need to provide its full path.

In the terminal, run this to get the path to the command on your system:

which corecli
--> /opt/local/bin/corecli
or 
--> /usr/local/bin/corecli

Then you can run these to most probably see that the result is in the first path but not the second.

From the terminal:

env | grep '^PATH'

From script editor:

do shell script "env | grep '^PATH'"

So, if this command was in /opt/local/bin/ then change your command to this:

do shell script "/opt/local/bin/corecli -clientserver -getFontDataByIDs Font-IDs=123"

You can get more details on running shell scripts with applescript from Apple’s tech note TN2065.

Thanks, Mockman, that was incredibly helpful. In my case, it is in /usr/local etc. At least now it runs without erroring.

The next hurdle is getting results back. I tried getting it into a variable, but it’s returning an empty string.

Thanks also for the pointer to the Tech Note. I’ll definitely need to give that a fuller read.

And just coming back here to say that I think my issue with getting an empty string back has nothing to do with the script per se. It’s also not getting responses when run directly in Terminal now either. Maybe a restart is in order.

Glad you got that part of it figured out. I took a quick look at the documentation from the link you provided. Your syntax looks fine (assuming the IDs are what they’re supposed to be) so maybe there’s another issue. Do commands that return something regardless of your setup work? e.g.

corecli -getAgentProductMode

They did before, when running them through the Terminal. Now they’re not working there either. Just did a restart and it didn’t help. corecli -getAgentProductMode doesn’t return anything either. It did earlier.

And, yes, on my server, that is a valid font ID. Previously, it returned a ton of data about one specific font when run in Terminal. I’m not sure what I did to it, but looks like I broke something.

I think it mentioned in the docs that this would likely mean that the server wasn’t running (but maybe I’m imagining that).

Thanks, and yeah, that seems likely. I have to connect to this server via VPN and it’s possible the connection dropped. Seems to be working this morning.

Thanks again for your help. I should be able to get some useful info out of this.

1 Like