5 Replies Latest reply on Nov 22, 2012 5:19 AM by shi

    Running a Filemaker script from Windows Task Scheduler

    shi

      I have FileMaker Server 12 Advanced with clients around the state. I need to run a script nightly that combines the data from all the files. The script works when I run it as a client, but because OPEN and CLOSE aren't functions that work on a server I can't get it to run successfully with the FileMaker server scheduler. I read a post that recommended to run it from Windows Task Scheduler but I don't know how to create something that will log into the database that contains the script so it can execute the build script. It needs to run unattended overnight, any suggestions for me?

       

      Thanks

        • 1. Re: Running a Filemaker script from Windows Task Scheduler
          wimdecorte

          Are all the files hosted on that one FMS?  Then an FMS server-side schedule would work.  You don't need the Open or Close script steps because on FMS, the files are always open.  So I would work on that, that is going to be more robust than trying to set something up with the Windodws Task Scheduler.

           

          Windows task schedule would need FM Pro to open a launcher file that will haven an on-open script set up.   Not a good idea to do this on the FMS machine itself so you'd need a robot workstation for this.

          • 2. Re: Running a Filemaker script from Windows Task Scheduler
            GordonShewach

            To add to Wim's suggestion of a launcher file with an on-open script step, have the launcher file's File Options set to login automatically using an account name and password that exist in the real file you're trying to access. This will allow you to bypass the credentials dialog box when your launcher file opens the real file.

             

            Also, I put commands at the start of my on-open script step that will allow you to abort the on-open script step. Otherwise, if you need to adjust anything in the launcher file, it will be difficult to get to it. Something like:

             

            If [Get ( ActiveModifierKeys ) = 4

                Show Custom Dialog ["Abort?"; "Abort on-open script?"]

                If [Get( LastMessageChoice ) = 1]

                    Halt Script

                End If

            End If

            Perform Script ["The real script you're trying to run in the real file"]

            Exit Application

             

            Modifer Key 4 is the Control key, so if you hold down the Control key while opening the launcher file, you'll get prompted to abort the on-open script step.

             

            Gordon Shewach

            Desktop Services

            Ann Arbor, MI

            • 3. Re: Running a Filemaker script from Windows Task Scheduler
              shi

              All the files ARE on the server and you're probably right.  I think it just appears that the files aren't open because it error's on the import.  The script imports from fm12 files into the state file and it ends at the first import.  It appears it's because the file isn't open but as I research further it may not be finding the file in the first place.  When I read the description in the FileMaker reference it appears that importing server-side has restrictions on the location/path.  My files are in subfolders of the databases folder for the server.  Do you think I'm on the right track and it's actually my path?

               

              Actually, after I wrote this I found a post that said a server-side script will not allow import/export to/from another filemaker file.  It suggested running it from the OS or exporting to a different file type first.  How would I call a filemaker script from a batch or shell file?

              • 4. Re: Running a Filemaker script from Windows Task Scheduler
                wimdecorte

                shi wrote:

                 

                All the files ARE on the server and you're probably right.  I think it just appears that the files aren't open because it error's on the import.  The script imports from fm12 files into the state file and it ends at the first import.

                 

                Direct FM to FM import is not supported server-side.  The easiest way around it is to export to CSV/Merge in the FMS documents folder and have the other file import from there.

                • 5. Re: Running a Filemaker script from Windows Task Scheduler
                  shi

                  Instead of doubling the size and runtime of an already lengthy script I'm trying to call it from the task scheduler from a client machine running Windows 7.  It's giving me an error code 2147942593 which is failure to launch and start the program.  I can run this startup program manually, however it does ask for account information when it opens.  Do you think that's why I'm getting the error, even though I created the same account as a user and run the scheduled task as that account?

                   

                  This seemed like the easier way to go because I hate to increase the size and time to run of this script, but I'm close to taking the less attractive option of changing the script.