Jump to content

Cancelling a dialog box without user intervention


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

Recommended Posts

I have a FM 6 file with a script that shows a warning message if a user quits the application (not the file). This is needed to constantly re-educate users who quit the application without thinking. This script is triggered by FM preferences to be run if the application is quit.

The problem is, if this script is triggered by someone choosing to quit the application, whether you use Show Message or Custom DIalog, the user has to do something (click a button) to cancel the dialog and allow the application to go ahead and quit. Otherwise it just hangs up there on the dialog. For various reasons I am running another script from this database remotely on a regular basis, and need to be able to quit without human intervention despite the dialog box. (Why? because my network is unreliable, but that's a long story and just accept that I need to quit the application). How could I write this script so after showing the message for 30 seconds or so, it would proceed on its own and allow the application to quit?

Thanks in advance.

Link to comment
Share on other sites

Interesting problem, SelfIT,

There's several ways you could come at it.

1. Instead of using a message dialog, create a look-alike layout in a FileMaker file, call a script to bring it to the front and zoom the window up small like a dialog, then record the time in a global field and pause the script in a loop until 30 seconds has elapsed, then have the script exit the loop - eg:

Exit Loop If ["Status(CurrentTime) >= gTimeField"]

- and continue with the close sequence.

2. Use one of the various plug-ins such as Troi Dialog, to provide a flash dialog which will appear for a defined period, controlled by your script.

3. Use a plug-in such as DialogMagic, which has the capability to issue an enter keystroke from within a script, and time it to dismiss the message dialog after 30 seconds has elapsed.

Depending on your platform and operating system version, there may be other options involving scripting languages or third party automation utilities - but I won't get into guesswork about that. Hopefully the above idea will give you something to get started with. wink.gif

Link to comment
Share on other sites

Thanks very much for your solution; it sounds a lot more versatile than the one I came up with in the meantime.

For those who might be interested, I solved the problem this way. I modified the script that would run when the file or app was quit, putting in an If statement that if a flag global field was set to "1", it would simply close and not show any message at all; otherwise it would show the message that required user cancellation. It would also set the flag to "0" at the same time.

On the slave computer running the script-running loop, I modified the script that opened the file on the server and ran the scripts within the shared file. It now inserts a "1" in the flag field, so that when the slave program closes the connection, no message box is shown and thus the file closes. Thus, each time the slave opens the shared file it in effect gives itself permission to exit without the message being displayed, without use of a different password. Scripting for this was simple, as you can imagine.

Thanks again for your help.

Link to comment
Share on other sites

This topic is 6567 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
 Share

×
×
  • Create New...

Important Information

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