Saturday, June 24, 2017

#1 2017-01-28 12:33:21 pm

benlong
Member
Registered: 2004-12-27
Posts: 47

Referencing an application indirectly

I have a collection of Photoshop Actions that I need to update. Unfortunately, Adobe keeps changing the name of the application, so every year I have to modify and recompile all 93 actions and, honestly, it's tedious.

Ideally, I'd like to just store the name of the application in a text file somewhere, load it into a variable and then use that variable in all my tell blocks instead of the hard-coded name. As you may already know – and which I just found out – this doesn't work. Any suggestions for a work-around?

Offline

 

#2 2017-01-28 06:15:29 pm

Shane Stanley
Member
From: Australia
Registered: 2002-12-07
Posts: 5022

Re: Referencing an application indirectly

Address apps by id rather than name. It's generally better in scripts you distribute for a variety of reasons. So:

Applescript:

tell application id "com.adobe.Photoshop"


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2017-02-04 07:17:22 pm

benlong
Member
Registered: 2004-12-27
Posts: 47

Re: Referencing an application indirectly

Thanks Shane, that works great. I didn't realize you could do that.

However, I also didn't realize that I'm still screwed by the plist file, which needs to have the application name in it. I can easily batch change those with BBEdit, but I still have to re-compile everything. Can you think of any way to make that bit independent of Application name changes?

Thanks! This is very helpful!

Offline

 

#4 2017-02-04 07:36:04 pm

Shane Stanley
Member
From: Australia
Registered: 2002-12-07
Posts: 5022

Re: Referencing an application indirectly

Can you just say Photoshop in the property list file?


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.158 seconds, 8 queries executed ]

RSS (new topics) RSS (active topics)