Jump to content

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

Recommended Posts

I have a script which opens a new (dialog) window for user to enter information. The script pauses while information is entered.

I want to allow the user to cancel the script (i.e. leave User Abort on) but if they do, I want the record to revert and the window to close automatically.

I tried:

If [ Get (Script Result) = "Cancel"]
Revert Record/Request [ ]
Close Window [Current Window]
Exit Script [ ]

but that doesn't seem to work.

Any thoughts?

Link to comment
Share on other sites

12 hours ago, millmaine said:

I want to allow the user to cancel the script (i.e. leave User Abort on)

Aborting a script and cancelling a dialog are two very different things. If the script is aborted at some point, then it doesn't matter what steps it contains after that.

Link to comment
Share on other sites

As Wim said, use Get ( LastMessageChoice ) to get a user's selection from a custom dialog. But your script example and the wording of your post leads me to suspect that you aren't using FileMaker's built-in custom dialog, but a new window with the modal dialog window style. If the user is clicking a "Cancel" button in that layout while the script is paused, have that button set a global variable (and to resume currently paused scripts), and have the main script check that variable instead of Get ( ScriptResult ). If the user really is canceling the script, and not just triggering another script while the first script is paused, then you can do your clean-up in a separate script called with an OnTimer trigger.

Edited by jbante
Link to comment
Share on other sites

7 hours ago, jbante said:

As Wim said, use Get ( LastMessageChoice ) to get a user's selection from a custom dialog. But you're script example and the wording of your post leads me to suspect that you aren't using FileMaker's built-in custom dialog, but a new window with the modal dialog window style. If the user is clicking a "Cancel" button in that layout while the script is paused, have that button set a global variable (and to resume currently paused scripts), and have the main script check that variable instead of Get ( ScriptResult ). If the user really is canceling the script, and not just triggering another script while the first script is paused, then you can do your clean-up in a separate script called with an OnTimer trigger.

You're correct. The link to the OnTimer trigger seems to deal with exactly my issue. I'll download the sample file and explore that.

Link to comment
Share on other sites

This topic is 3186 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.