AnsweredAssumed Answered

MacOS: On database open, enter full-screen mode

Question asked by edwardlscott on Apr 18, 2018
Latest reply on Apr 18, 2018 by edwardlscott

I wrote an applescript that successfully puts FileMaker into full-screen mode. I would like to run it from my file's "On First Window Open" script so whenever the database is opened the presented window goes into full-screen mode.  NOTE: I renamed my FileMaker Pro Advanced executable file in my applications folder to "FMPA16" as reflected in the code below.  Here is my working applescript code (BTW, the script is written to toggle back and forth when run/re-run):

 

global gWindowmode

 

try

  gWindowmode

on error

  set gWindowmode to 0

end try

 

if gWindowmode = 1 then

  set gWindowmode to 0

  tell application "FMPA16"

  activate

  delay 0.25

  tell application "System Events" to tell process "FileMaker Pro Advanced"

  set value of attribute "AXFullScreen" of window "My_Window_Name" to false

  end tell

  end tell

 

else

 

  set gWindowmode to 1

  tell application "FMPA16"

  activate

  delay 0.25

  tell application "System Events" to tell process "FileMaker Pro Advanced"

  set value of attribute "AXFullScreen" of window "My_Window_Name" to true

  end tell

  end tell

end if

 

Magically, that script works, whether I open it in ScriptEditor and run it, or whether I store the script file to the computer script folder and run it from the Script Menu Bar item.  However, when I put the code into a "Perform Applescript" script step it does not work, whether I set it up as "Native Applescript" or "Calculated Applescript".  I also have tried every perturbation of the "Send Event" I could come up with, sending "do script" or "open documents" options in combo with the code in a disk file or code in the script step, and while specifying applications "Script Editor" or "SystemUIServer", and/or "System Events".

 

One other note: In System Preferences > Security and Privacy > Privacy > Accessibility, I added Script Editor, SystemUIServer and System Events as applications that can control my computer.

 

Can someone smarter than me guide me to a way to make this work or am I just banging my head ... ?

 

Thanks in advance,

Ed

Outcomes