1 Reply Latest reply on Sep 29, 2016 1:20 PM by justinc

    open file scrip problem

    john9210

      I’m trying to open a FMP file called “Office” with a script within a parent file. The script has two steps: one to open Office the other to run the Startup script in Office.

      Open File [ “Office” ]

      Perform Script [ “Startup” from file: “Office” ]

      I would expect that when the Office file opens the layout defined in Startup would be active since the script ends there. However, the parent file layout remains active.

      Also, after I exit FMP and then reopen the parent file, the script “forgets” where the Office file is located and FMP presents a dialog where I have to navigate to the file to find it. It’s almost like the path to the file is not stored in the Open File script step.

        • 1. Re: open file scrip problem
          justinc

          John,

               First, as an FYI you don't really need the 'Open File...' step; simply calling the "Perform Script..." in the external file will cause it to open the file.  It won't hurt anything to use it, it's just not required.

               Second, the layout that is active:  when your script in the Parent file runs and opens the 'Office' file, it runs the 'Startup' script in 'Office', yes...but then it returns to the 'Parent' file and the calling script, and exits that script.  You might simply need a 'Select Window' step to reactivate the window from the 'Office' file.

               Third, do you have any scripts defined for the 'OnFirstWindowOpen' script trigger in the 'Office' file?  Those triggers will also be running when you open that file.

               Lastly, you are correct - the path is NOT stored in the script step.  The path to the 'Office' file is stored in the 'External Data sources' of the 'Parent' file.  If the path defined there to the 'Office' file isn't correct, it will ask you to find the file being referenced.  You actually should get that dialog any time you try to access something from Office: a layout with fields from it, the Manage Database window, etc.

           

          -- Justin