Sunday, June 16, 2019

#1 2012-06-04 05:30:52 am

zmagyar
Member
Registered: 2004-01-26
Posts: 18

Any other way to refer to an application other then with its name

I have one particular problem with file maker pro.
On the mac there are both FMP11 and FMP12 installed.
I have a script which makes FMP open a doc and do some processing.
The script worked so far OK but the new is that I have both FMP11 and FMP12 docs mixed. So I have to open appropriate FMP to do the job.
The trouble is that they are both registered with the same name in the AppleScript Application listing, so if I "tell application File Maker Pro Advanced", it does not strictly define to which one am I telling.
I tried to trick the problem by quitting all FMPs and then open a FMP11 or FM12 dummy document through Finder, this will start the appropriate FMP version, but then when I want to switch to it with activate, or I use the tell for the first time after that, if the one which is open is FMP11 all works fine, if the FMP12 is open, the tell statement will open the FMP11.
The strangest thing of all is that in another simplified version of the script, it works fine.

So my question is: is there any other way of using the tell application then with the registered Name of the application?

I tried to get the properties for both FMP11 and FMP12 and here is the result:

FMP11

get properties of application process "FileMaker Pro"
        --> {enabled:missing value, unix id:63125, file:alias "MACHD:Applications:FileMaker Pro 11 Advanced:FileMaker Pro Advanced.app:", creator type:"FMP7", subrole:missing value, entire contents:{}, selected:missing value, application file:alias "MACHD:Applications:FileMaker Pro 11 Advanced:FileMaker Pro Advanced.app:", orientation:missing value, role:"AXApplication", accepts high level events:true, file type:"APPL", value:missing value, position:missing value, id:25741451, displayed name:"FileMaker Pro Advanced", name:"FileMaker Pro", class:application process, background only:false, frontmost:false, size:missing value, visible:true, Classic:false, role description:"application", maximum value:missing value, architecture:"i386", partition space used:0, short name:"FileMaker Pro Advanced", focused:missing value, minimum value:missing value, help:missing value, title:"FileMaker Pro Advanced", accepts remote events:false, description:"application", total partition size:0, accessibility description:missing value, has scripting terminology:true, bundle identifier:"com.filemaker.client.advanced"}

FMP12

get properties of application process "FileMaker Pro"
        --> {enabled:missing value, unix id:63199, file:alias "MACHD:Applications:FileMaker Pro 12 Advanced:FileMaker Pro Advanced.app:", creator type:"FM12", subrole:missing value, entire contents:{}, selected:missing value, application file:alias "MACHD:Applications:FileMaker Pro 12 Advanced:FileMaker Pro Advanced.app:", orientation:missing value, role:"AXApplication", accepts high level events:true, file type:"APPL", value:missing value, position:missing value, id:25753742, displayed name:"FileMaker Pro Advanced", name:"FileMaker Pro", class:application process, background only:false, frontmost:false, size:missing value, visible:true, Classic:false, role description:"application", maximum value:missing value, architecture:"i386", partition space used:0, short name:"FileMaker Pro Advanced", focused:missing value, minimum value:missing value, help:missing value, title:"FileMaker Pro Advanced", accepts remote events:false, description:"application", total partition size:0, accessibility description:missing value, has scripting terminology:true, bundle identifier:"com.filemaker.client.advanced12"}


So it seems that the string appearing in Dictionary of the Apple Script Editor is the displayed name, short name or title propery but they are same for both apps.

So how can I open and tell to the appropriate FMP version, any idea?

Browser: Safari 534.57.2
Operating System: Mac OS X (10.7)

Offline

 

#2 2012-06-04 05:47:50 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11563
Website

Re: Any other way to refer to an application other then with its name

Hi,

use the bundle identifier in conjunction with application id
for FMP 11

Applescript:

tell application id "com.filemaker.client.advanced"

for FMP 12

Applescript:

tell application id "com.filemaker.client.advanced12"


regards

Stefan

Offline

 

#3 2012-06-04 06:12:45 am

zmagyar
Member
Registered: 2004-01-26
Posts: 18

Re: Any other way to refer to an application other then with its name

Works! Brilliant...Thanks a lot.
For those who have similar problem, I found another post here http://macscripter.net/viewtopic.php?id=24569 which goes further in details.

Offline

 

#4 2012-06-04 06:15:06 am

mouramartins
Member
From:: Algarve
Registered: 2010-11-21
Posts: 156

Re: Any other way to refer to an application other then with its name

In these conditions you can address the particular application file:

Applescript:


tell application "Finder"
   open file "BoxxyDisc:Applications:FileMaker Pro 11 Advanced:FileMaker Pro Advanced.app"
end tell

From here on tell application "FileMaker Pro Advanced" ...

Last edited by mouramartins (2012-06-04 06:19:28 am)

Offline

 

#5 2012-06-04 06:23:13 am

zmagyar
Member
Registered: 2004-01-26
Posts: 18

Re: Any other way to refer to an application other then with its name

mouramartins wrote:

In these conditions you can address the particular application file:

Applescript:


tell application "Finder"
   open file "BoxxyDisc:Applications:FileMaker Pro 11 Advanced:FileMaker Pro Advanced.app"
end tell

From here on tell application "FileMaker Pro Advanced" ...


No, this does not work, I opened a dummy file instead, but as long as I open FMP11 file which starts FMP11, the later used "tell application FileMake Pro Advanced" works fine, but if I open a FMP12 file no matter FMP12 is started, the "tell application FileMake Pro Advanced" will start FMP11! Strange but true...

Offline

 

#6 2012-06-04 06:45:00 am

mouramartins
Member
From:: Algarve
Registered: 2010-11-21
Posts: 156

Re: Any other way to refer to an application other then with its name

zmagyar wrote:

No, this does not work, I opened a dummy file instead, but as long as I open FMP11 file which starts FMP11, the later used "tell application FileMake Pro Advanced" works fine, but if I open a FMP12 file no matter FMP12 is started, the "tell application FileMake Pro Advanced" will start FMP11! Strange but true...


sad Oh! Works for me with other applications, but no FMpro 12 here. Conclusion: it will start failing soon! Time to revise, because I will have that problem. Thanks.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)