Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6991 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm assuming a script could somehow do this:

We would like to now host the database on our local machine, however power outtages are always a concern. We now have a UPS system giving us 15 minutes of power.

However we have the windows OS go to hibernation mode after 5 minutes on battery power. I created a test database to see what would happen when the computer tried to go to sleep mode and filemaker actually has a dialog box saying the files have to be closed before sleep mode occurs or it will cancel the request.

Is there a way to automatically close the file (etc) when the computer wants to go to hibernation mode (or shutdown)?

Thanks for any ideas!

phd2972t1n.jpg

Posted

I assume you want to click the Yes button.

I don't know if there is any way to pick up within FMP that this message has occurred, if there is I am sure someone on these forums will know. But you could pick it up from outside FMP. For example, start FMP with an operating system script, or start a script from within the opening script of your FMP file, and then leave the script running in the background monitoring for this message box - I think there is enough unique text together with the Filemaker Pro title to be able to be sure that you have it, and then work out what collection of keystrokes to send to the windows which will hit the Yes button.

I am sure this could be done with my favourite scripter AutoIt and I would hazard a guess that it can also be done with VBScript or JScript.

Posted

Thanks SlimJim...I used autoit for our runtime programs (but only to resize the window). Do you have a suggestion on how to do this with autoit? I'm green as it comes to autoit ;)

Posted

You need to stage what happens when power goes out. Have the UPS software trigger a VBscript to talk to FM and close all open files. (See the FM help file under ActiveX). Do this well before you've scheduled the machine to hibernate.

Posted

You can do it with Autoit by having a script running in the background with the commands

WinWaitActive("Filemaker Pro","Sleep will be denied automatically in 30 seconds")

Send("{TAB}")

Send("ENTER")

The last two lines of the script are to hit the Yes button and you should check precisely what keystrokes to send to achieve that. It looks to me from the screen shot that NO is the default in which case you will have to TAB to Yes and then ENTER.

Having said all of this there are some provisos and the main one of course is thst the script must not be stopped (it shows in the system tray while it is waiting). I am not familiar with UPS and Wim's suggestion of getting the UPS software to run a VBScript is certainly safer. Alternatively you maybe could run the AutoIt script from the UPS.

If you can get both methods working (VBScript & Autoit) then I would recommend the VBScript route as VBScript is more tied into the operating system whereas AutoIt is more tied into the GUI. That is an opinion only - I am not trying to start a discussion on the relative merits of scripting languages. I use AutoIt because there is virtually no learning curve. Think what you want to do, look at the help file and do it (or not! as the case may be)

Posted

Wow that is cool with autoit! It worked! The only problem comes in when there are connected users. I can add the code to 'ask' them (thus disconnecting them in 30 seconds) but if they are not connected then the script hangs.

For the UPS software...we have Tripp Lite and have "Power Alert" software. It works fine (shuts down filemaker) but if you have connected users it goes in this endless cycle of hitting 'cancel' instead of 'ask' in the popup dialog.

I'm wondering if there is an auto-disconnect script available? For example when included in the exit script it will also disconnect any users right away without asking them.

Thanks!

This topic is 6991 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.