millmaine Posted November 5, 2015 Posted November 5, 2015 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?
Wim Decorte Posted November 5, 2015 Posted November 5, 2015 if your script is paused then you can not use get(scriptresult) since you are still within the same script, Use get(lastmessagechoice) instead
comment Posted November 5, 2015 Posted November 5, 2015 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.
jbante Posted November 5, 2015 Posted November 5, 2015 (edited) 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 November 6, 2015 by jbante
millmaine Posted November 5, 2015 Author Posted November 5, 2015 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.
Recommended Posts
This topic is 3578 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 accountSign in
Already have an account? Sign in here.
Sign In Now