4 Replies Latest reply on Mar 7, 2010 2:06 PM by david583

    Re-log in script

    david583

      Title

      Re-log in script

      Post

      Filemaker Pro 10, Windows XP & Vista, Hosted Network (6 users)

       

      I currently open my FM file using a script, in the script I have a re-log in step for the current user to log in.

       

      I have switched on error capture and am looking for errors 212 & 213 for invalid users. This works fine.

       

      However, if I press cancel instead of entering a username the application opens and editing is available (i.e. not guest)

       

      Is there a way I can trap the cancel button in the log in screen to provide a dialog and exit the system? Or am I just missing something simple.

       

      My log in script is:

         Go to Layout [ "start_screen" (START_SCREEN)

         Set Window Title [ Current Window; New Title: "CSDdb2.0: CSD Orders and Remake Database"

         Perform Script [ "daily_smiley"]

         Show/Hide Status Area [Hide]

         Show/Hide Text Ruler [Hide]

         Adjust Window [Maximise]

         Set Error Capture [On]

         Re-Login [ ]

         If [Get (LastError) = 212 or If [Get (LastError) = 213 ]

              Show Custom Dialog [ blah blah try again ]

              Re-Login [ ]

              If [Get (LastError) = 212 or If [Get (LastError) = 213 ]

                   Show Custom Dialog [ blah blah try again ]

                   Re-Login [ ]

                   If [Get (LastError) = 212 or If [Get (LastError) = 213 ]

                        Show Custom Dialog [ blah blah too many tries exit application ]

                        Exit Application

                   End If

              End If

         End If

         Set Error Capture [ off ]

         Halt script

        • 1. Re: Re-log in script
          philmodjunk

          You can use the function Get ( LastMessageChoice ) to determine which button in the custom dialog was clicked. It'll return 1, 2, or 3 with 1 being the number of the default button in the dialog.

          • 2. Re: Re-log in script
            david583

            Thanks for replying so fast Phil.

             

            Doesn't seem to work. There are three buttons on the dialog, change password, OK and cancel. I have tried 1, 2 and 3.

            Doesn't seem to have any effect.

            Is the login dialog just like a user created dialog?

            Still ignores my if statement and opens the database.

             

            Very confused now

            • 3. Re: Re-log in script
              philmodjunk

              I assumed your were trying to cancel a custom dialog. Get ( LastMessageChoice ) only refers to custom dialogs.

               

              One option is to set the file to open with a password that only permits read-only access. That way, cancelling the re-login leaves your file protected.

               

              Another options is to set up your re-login to work without the dialog.

               

              Pop up a custom dialog with input fields for account and password. (Use the password format to echo user's password with bullet characters).

              Set these input fields to store their results in global text fields.

              Run the Re-login step with calculations that refer to the global text fields for account name and password.

              • 4. Re: Re-log in script
                david583

                Thanks Phil,

                I can log in using a guest account and it works fine.

                Appreciate your help again. :smileyvery-happy:

                 

                David