8 Replies Latest reply on Mar 13, 2010 4:09 PM by Steve Wright

    How to auto close a layout due to inactivity

    braxton

      Title

      How to auto close a layout due to inactivity

      Post

      I've looked all over for this but can't figure out hot to use a trigger and script to do close a layout due to inactivity.  And, can I close a file as well do to inactivity?  Thanks for any help.

       

      Braxton

        • 1. Re: How to auto close a layout due to inactivity
          Steve Wright

          I myself used a free script trigger plugin to achieve it. Since there was an option for performing a script after a period of inactivity / using the idle timer

           

          i.e : http://myfmbutler.com/index.lasso?p=416

          This works really well for me !

           

          I have yet to explore if this can be achieved in FM10 / 11 using native script triggers, but I suppose it would depend on how your solution is designed .

           

          Here is an example (untested which I just thought up) which I wouldn't recommend using either...

          but may  give you a starting point to think on..

           

          an OnTimer trigger could be set which would run : 

           

          If [ $$idle_fieldname <> get(activeFieldName) or $$idle_layout <> Get(CurrentLayout) or $$idle_record <> get(recordnumber) ]

          Set Variable [ $$idle = 0]

          Set Variable [$$idle_fieldname = get(activefieldname) ]

          Set Variable [$$idle_layout = get(layoutname) ]

          Set Variable [$$idle_record = get(recordnumber) ]

          Else

          Set Variable [ $$idle = $$idle + 1]

          Set Variable [$$idle_fieldname = get(activefieldname) ]

          Set Variable [$$idle_layout = get(layoutname) ]

          Set Variable [$$idle_record = get(recordnumber) ]

          End If

           

          If [ $$idle > 10 ]

          Perform commit / exit stuff

          [end if]

           

           

          The idea here is checking if the user is on the same layout / same field / same record before incrementing the $$idle variable, if they are not then the variable resets to zero, since they are not idle.

           

          Whilst this may work if the user is constantly changing layouts / fields, if a user is sat in a field entering data for 10 minutes it would fail.  Other things could cause it to fail too which is why I would not use it until I was sure I could capture enough info to make it consistent.

           

          Basically, it would take more than I have put above to get this working.. .others may know a simpler solution

          • 2. Re: How to auto close a layout due to inactivity
            LeoB

            Being a new user, I was scanning the forum and saw this post.  If you have time, what would be the advantage/purpose of auto-closing a layout?

             

            Thanks

            • 3. Re: How to auto close a layout due to inactivity
              Steve Wright

              Well in my case, I only use something similar to above when users are on a 'main menu' type layout to auto log the user out after 1 hour of in-activity (or whatever time they specify)  I do not trigger the action if they are on any other type of layout, i.e a data entry one, to avoid problems with incomplete records etc.

               

              I only made use of it due to a number of clients requesting this ability.

              • 4. Re: How to auto close a layout due to inactivity
                braxton

                Thanks SWS

                 

                Leo - I have a friend who is mentally ill.  It's incredible how she has overcome her disability through medication, therapy, and will power.  She needs to monitor her thoughts and feelings.  Her therapist recommended she have a journal.  She has always wanted to keep one but was really afraid someone would see it.  So, I created a journal that is password protected and she can't get enough of it.  Furthermore, she is able to print out and share her thoughts with her therapist.  There is a concern that while writing in the journal she gets distracted and walks away from it.  I would be nice if the whole file would close out if she was not writing in it for 5 minutes or so.

                 

                See "Script Triggers in Action"  talks about this as a feature of Filemaker 11.  I believe it was also in 10.  I couldn't figure it out last night.  I'll have to look it over again.  It would be cool if there was a Time or Event Trigger where time was measured and specified....then go on to a script closing out the file.

                 

                Thanks.

                • 5. Re: How to auto close a layout due to inactivity
                  Steve Wright

                  See "Script Triggers in Action"  talks about this as a feature of Filemaker 11. 

                   

                  It does indeed.... Am I missing something then... because I cannot find anything which relates to a trigger based off idle time.

                   

                  • 6. Re: How to auto close a layout due to inactivity
                    LeoB

                    Ahhh...an auto log-out function.  I was too focused on the word "layout," thinking that there would be a need to automatically close a layout and go to another.

                     

                    Thanks.

                    • 7. Re: How to auto close a layout due to inactivity
                      braxton

                      Got it!  

                       

                      I actually want to close out the file after inactivity.  You can choose to do something else.  Basically to do something after idle time, create a script of what you want to do,  create another script using the Install On Timer Script that starts the script of what you want to do after specified seconds, then set the relevant triggers to activate the script based on the Install On Timer Script.

                       

                      Here's more from what I want to do:

                       

                      Create "Close File" Script

                      Manage Scripts > New Script > Files > Close File > Current File

                       

                      Create "Install On Timer Script" that performs on "Close File" script.  Maybe label this script Close After Idle Time.

                      Manage Scripts > New Script > Control > Install On Timer Script > specify "Close File" Script / specify seconds (idle time)

                       

                      In Layout mode go to Layouts > Layout Setup > Script Triggers > Select:

                      Select all relevant Event Triggers and select your "install On Timer Script" or Close After Idle Time.  Each time one of these events happen then the Install On Timer Script starts over again.

                       

                      For my situation, I'll choose:  OnRecordLoad, OnLayoutKeystroke, OnLayoutEnter.  So, when the record loads the CloseAfterIdleTime script is activated.  When someone types it will stop and restart the CloseAfterIdleTime.  If someone goes to another record it restarts the CloseAfterIdleTime script and so on.  Finally, if nothing is going on for my specified idle time then the file will close.  Works like a charm.

                       

                      I'll probably go further to have the first Install on Timer Script activate a script with a warning dialog box and then run another timer script that closes the file.

                       

                       

                       

                      • 8. Re: How to auto close a layout due to inactivity
                        Steve Wright

                        Glad you got it working...

                         

                        Makes my approach look over-complicated lol.  Besides I forgot to add a step to reschedule the OnTimer event.

                         

                        I really should invest more time into changing my existing functions to use native script triggers :-P

                        I've been lazy since a lot of my requirements are already done using a plugin and up until recently I have been supporting solutions in Version 9, so had to steer clear.

                         

                        But on that note, the plugin approach I use doesnt require anything other than setting an on idle trigger once upon startup.  It uses FileMakers internal idle timers, which manage itself... so I don't have to have a script running every x minutes in the background or on any record / layout change etc.   I wonder why they did not tap into this themselves.