0 Replies Latest reply on Aug 29, 2014 9:53 AM by DavidMerrifield

    Problems opening a database using Applescript on Mac startup

    DavidMerrifield

      Title

      Problems opening a database using Applescript on Mac startup

      Post

           I wonder if anyone on the Forum can help a relative novice to sort out this Applescript conundrum.  I have been wading through so-called solutions for days now, and most seem to relate to earlier versions of FMP or indeed OSX. None work for me!
            
           I am running FMP Advanced 13 on a Mac running OSX Mavericks, and three further machines have remote access to it using simple FM peer-to-peer sharing (using FMP 13 and FMP Advanced 13). It all works fine.
            
           However, I want to automate the opening of the database each morning on the host machine (it is a timesheet and job trafficking system we have built). The Mac is set to shut down each evening and start up each morning to save energy, but we have to manually open the FMP database each morning before we can all access it from our client machines.
            
           I have tried creating an Applescript 'Application' to run as a Login item on startup, and it gets as far as opening the application, but does not open the database in question and simply hangs until we manually double-click the database itself to get it going.
            
           The script DOES work when tested in the Applescript Editor, but DOES NOT work when used as a Login Item when the Mac starts up.
            
           The script I have been using (based on information found elsewhere in various forums) is:
            
           tell applicaction "Filemaker Pro Advanced"
           open "Users:Macmini:Documents:Projects.fmp.12"
           delay 5
           activate "Filemaker Pro Advanced"
           go to window "Projects"
           end tell
            
           I suspect the 'activate' and 'go to' commands are pretty much redundant, but they were an attempt to make FMP show the database in the foreground. In fact, it gets as far as the Open Database dialogue, inviting me to double-click on the database itself to open it.
            
           Any suggestions gratefully received.
            
           Thanks