7 Replies Latest reply on Mar 18, 2014 9:00 AM by philmodjunk

    Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS

    FileMakerNovice

      Title

      Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS

      Post

           Hello,

           I have a database that accesses two external data sources.  Upon launch it prompts for the username and password for these sources.  Everything works swimmingly if they are entered correctly.  The trouble is that when the incorrect un/pw is entered a big ugly default FM message comes up.  WORSE: when cancel is pressed my startup script runs and gives all kinds of errors about unable to connect to the data.  I would like to know if any of the following is possible:

             
      •           Determining if "cancel" was pressed and quitting the program.  Something similar to a get(lastmessagechoice).
      •      
      •           Accessing EDS's with custom layout.  Something along the lines of: go to layout, enter global un/pw, press okay, connect to EDS1 and EDS2.
      •      
      •           Displaying custom messages using prettier layouts to inform of un/pw errors.

           I am using FM Pro Advanced 13.  Both EDS's are also in FM13.  Thanks in advance.

        • 1. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
          philmodjunk

               You can probably use Set Error Capture [on] to keep the error message from appearing and then use

               Get ( LastError ) to check for successfully opening the file and thus, you can then script your own method for what to do if the attempt to access the file failed or was canceled.

          • 2. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
            FileMakerNovice

                 Thanks for the quick response!

                 It appears that the EDS is logged into before any scripts are run.  Additionally, the get last error doesn't gather anything.  I have my StartUp script set at FileOption>SetScript trigger>OnFirstWindowOpen.  The first line is "SetErrorCapure[on]".  The next line is if get(lasterror) ≠ 0, then quit application.  The application does not quit.

                 It appears that the logging into the EDS's and it's errors happen before the first script is ever run thus, I cannot verify or gather what errors occurred.

            • 3. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
              philmodjunk

                   IN your script, Get ( lasterror ) would only return a nonzero value if Set Error Capture [on] produced an error.

                   What is "EDS"? Is this an ODBC data source?

              • 4. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
                FileMakerNovice

                     Apologies for any use of the incorrect abbreviations.  EDS is the external data source.  The external datasource is another FM database.

                     I do understand what you're saying there.  I cannot figure out a way to get an error and thus quit the app.  The username/password error is not as huge of a deal as the cancel not "canceling".  When cancel is pressed, the first error appears:
                     "The file “Test.fmp12” could not be found and is required to complete this operation." then:
                     "The previous script step, “Perform Script”, could not be completed because of an error.  Do you wish to continue with this script?"

                     Finally, as expected, any field referring to the external data source's data is "field missing."  

                      

                • 5. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
                  philmodjunk

                       I must guess that there are fields or a portal that references the external data source data on the layout that is current when your file opens.

                       Use a layout that does not have such objects, (it can be a completely blank layout), and have your script use Open (file) to open the EDS files with a get last error following each Open File stin an IF step that checks the value returned.

                       Note: if you define identical account names and passwords in each file, the EDS files will open without asking for a password. FileMaker will open them with the current file's account name and password.

                  • 6. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
                    FileMakerNovice

                         Is there any other reason a password prompt would populate on launch?  I have done some testing and cannot figure out why it is prompting.  I attempted the following to no avail:

                           
                    •           I created a new blank layout from a local test table with 0 fields.  Upon launch, this is the layout that the DB goes to.  
                    •      
                    •           I turned off my startup script.  I also turned off my shutdown script.
                    •      
                    •           I thought maybe it had something to do with the last layout the DB was on so I closed the app on the same blank layout.

                         All this and upon launch, a prompt for the password to the external data sources' password is still displayed.

                    • 7. Re: Auto-Quit upon incorrect un/pw or "cancel" pressed for EDS
                      philmodjunk

                           Using FIleMaker 13 in Windows 7, I ran the following simple test to make sure that no changes have crept in with the newer versions and to make sure that I wasn't missing any details in what I have suggested here.

                           I defined DB1 with a single table and a field named Test.

                           I opened manage|Security and specified a password for the Admin account.

                           I defined DB2 with a single table and a field named Test2.

                           I then duplicated the default layout that this process creates and added Test from DB1 to this additional layout. I then re-selected the original layout that just showed Test2.

                           I quit fileMaker to make sure that both files were closed.

                           I then re-opened DB2. No password dialog appeared and I saw the original layout--the layout I selected just before closing. But when I selected the second layout with the field from DB1 on it, a password dialog appeared.