AnsweredAssumed Answered

Sizing the FMPAdv app window using Applescript

Question asked by bcmillerway on Jul 2, 2017
Latest reply on Jul 3, 2017 by Markus Schneider

I'm using FMPAdv v14 on a MacBook Pro

 

Here's my script:

*********

set appHeight to 510

set appWidth to 600

 

tell application "System Events"

    set theApp to name of first application process whose frontmost is true

end tell

 

tell application "Finder"

   set screenResolution to bounds of window of desktop

end tell

 

set screenWidth to item 3 of screenResolution

set screenHeight to item 4 of screenResolution

 

tell application theApp

activate

reopen

set yAxis to (screenHeight - appHeight) / 2 as integer

set xAxis to (screenWidth - appWidth) / 2 as integer

 

set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}

end tell

***********

This script gets executed as an onStartup trigger script.

 

I have both Filemaker (v11) and Filemaker Pro Advanced (v14) installed.

 

The script is supposed to get the name of the application which is running the Perform Applescript script step, which is FMPAdv, but instead it opens Filemaker v11 and passes the sizing info to it.

 

The problem seems to be with this line:

"set theApp to name of first application process whose frontmost is true"

 

Why does this line set 'theApp' to "Filemaker Pro" instead of 'Filemaker Pro Advanced"?  Filemaker Pro isn't even open.

 

Help appreciated.

Thanks

Outcomes