Jump to content

Capture Error 1 - User Canceled Action


Recommended Posts

I have a script that prints off receipts in a loop, one for the office and then one to be given to the client. All works well, except sometimes we only need the office copy so I have a step :

Pause/Resume Script [ Indefinitely ]

At this point if we clink on Continue of press an ENTER key the script continues and prints the second receipt, but is we click on CANCEL, the script stops.  This is technically correct, but I want capture this Error Code = 1 and return the user to the original Client screen 

Go to Layout [original layout; animation: none]

.................................

I have tried and if Get (LastError) = 1 Go to Layout [original layout; animation: none] Else....

but this does not work.  Perhaps I have the capture at the wrong level, but have tried it in the loop and outside of the loop.  I would appreciate any ideas on what I am doing wrong or how this can be acheived.

TIA

 

Link to post
Share on other sites
Posted (edited)

If you cancel a paused script, the script is aborted - so it doesn't matter what steps you have after that. Try using a custom dialog to capture the user's decision.

 

Edited by comment
Link to post
Share on other sites
Posted (edited)
5 hours ago, comment said:

If you cancel a paused script, the script is aborted - so it doesn't matter what steps you have after that. Try using a custom dialog to capture the user's decision.

 

That is what I am tring to do.  When the script is paused ( Pause/Resume Script [Indefinitely] ) filemaker displays its own Continue & Cancel buttons.  Pressing the continue, all continues and works correctly.  I cannot seem to capture the CANCEL button click - any ideas?    The Get (LastError) = 1, which shows in the debug as "Error 1 - User canceled Action" evades capture!  Therein lies the issue..   

Or do I have to stop Filemaker displaying its own Continue | Cancel buttons in order to control the flow? If so, how would I do that?

 

Edited by chris7of9
Link to post
Share on other sites
10 minutes ago, chris7of9 said:

I cannot seem to capture the CANCEL button click

I think I have already answered this. You cannot capture the click of the cancel button, because there are no scripts running at this point.

10 minutes ago, chris7of9 said:

Or do I have to stop Filemaker displaying its won Continue | Cancel buttons in order to control the flow? If so, how would I do that?

I already answered this too: instead of pausing the script, show a custom dialog with 2 buttons and wait for the user response. This can be captured using Get(LastMessageChoice).

Link to post
Share on other sites

Ah ok.  I hadn't realised that by simply removing my Pause/Resume Script step and replacing it with a Custon Dialog box not only would I be automatically pausing the script, until the User responds, but then I have control and can exit the script cleanly and return to the original screen.

 

Thanks - sometimes one just needs a pointer.

Link to post
Share on other sites

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.