3 Replies Latest reply on Sep 18, 2012 11:34 AM by GaryVogt

    open script, How do I create one?

    GaryVogt

      Title

      open script, How do I create one?

      Post

           How do I create an open script"  

            

           The old version had an open script that I could edit.  I can't figure out how to creat an open script so that wne I open a file it resizes and goes to a specific layout.

        • 1. Re: open script, How do I create one?
          schamblee

               Goto "File Options" on the File menu then select Script Triggers.  Select the first option "OnFirstWIndowOpen" then create your open script.

          • 2. Re: open script, How do I create one?
            davidanders

            http://help.filemaker.com/app/answers/detail/a_id/7465/~/understanding-and-using-script-triggers

                 <SNIP>

            File Options

                 OnFirstWindowOpen - The script will be run when opening a window of a database file when no other windows for the file are currently open.

                 OnLastWindowClose - The script will be run when closing the last open window of a database file.

            Example of using a file option script trigger

                 One of the most common uses for an OnFirstWindowOpen trigger is to customize the user experience for individuals or groups. For example, you could have a database that both teachers and students access. If the user logging in is a teacher, you may want to take them to a layout with their lesson plan and schedule for the day. Meanwhile, if a student logs in, they should be taken to a layout that displays their schedules and requirements for each.

                 In this simplified example, we will take user A to layout A, and user B to layout B.

            Step 1. Create two new accounts named "User A" and "User B" via "Manage Accounts & Privileges."

            Step 2. Create two layouts named "Layout A" and "Layout B."

            Step 3. Create the following script and name it "Opener Script."

                 
                      

            If [ Get ( AccountName ) = "User A" ]

                      

            Go to Layout [ "Layout A" (People) ]

                      

            Else If [ Get ( AccountName ) = "User B" ]

                      

            Go to Layout [ "Layout B" (People) ]

                      

            End If

                 

            Step 4. Navigate to File > File Options…

            Step 5. Under "When opening this file", check "Perform Script."

            Step 6. Specify the "Opener Script" we just created. Hit Ok.

            Step 7. Uncheck "Log in using". This will cause the user to be prompted for login information when opening the database.

            Step 8. Hit Ok to save and close the File Options window.

            Step 9. Close the file and reopen it.

            Step 10. Log in with the "User A" account.

            Step 11. Close the file, re-launch, and log in with the "User B" account.

            Result: Logging in with the "User A" account will take you "Layout A." While logging in with "User B" will take you to "Layout B."

            • 3. Re: open script, How do I create one?
              GaryVogt

                   Thanks evryone for the info.  Funny, I looked all over the Scripts management section.  Never thought to look at File Options.  Silly me.