Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Preview[Pause] + Cancel

Featured Replies

I want a script to put up a window in Preview mode, pause, and allow the user to either (a) proceed to a Print step, or (: cancel but allow the script to continue running.

As far as I know, there is no way to put active buttons on a window in Preview mode. What I'm trying, then, is the following:


Allow User Abort [On]     /* Cause Cancel button to be shown */

Allow Error Capture [On]     /* Let me handle errors */

Show/Hide Status Area [show]     /* Display side bar and buttons */

Enter Preview Mode []     /* Show current layout in Preview mode */

Pause/Resume Script [indefinitely]     /* Wait for user to click Continue or Cancel */

Set Variable [ $errcd ; Value: Get( LastError ) ]     /* Try and learn what was pressed */

If [ $errcd = 0 ]

               /* The user clicked Continue */

Else

               /* The user clicked Cancel */

End If

Unfortunately, if I press Cancel in the Status area sidebar, it cancels the script immediately, instead of allowing me to handle it. Is there any way to do this?

Thanks,

Chap

Show the status area so the "Continue" button is visible. When the script is resumed, show the print dialog. Users can just cancel it to avoid printing.

Set user abort to off so the "Cancel" button doesn't appear in the status area.

Also, get OUT of the habit of turning error capture on by default. This suppresses FMP's error messages. The error messages can actually warn you and the user when something is wrong. Only turn it on when you want to trap for errors (like after a find) and turn it back off again straight afterwards.

...

Allow User Abort [Off]

Show/Hide Status Area [show]

Enter Preview Mode []

Pause/Resume Script [indefinitely]

Print []

...

If you want to see whether the user printed, trap the error from the Print step. The error code is 1 when the user clicks cancel.

Allow User Abort [Off]

Show/Hide Status Area [show]

Enter Preview Mode []

Pause/Resume Script [indefinitely]

Set Error Capture [on]

Print []

Set Variable [$error]

Set Error Capture [off]

If [$error = 0]

#user printed the document

Else If [$error = 1]

#user cancelled print step

Else

#some other error occurred that stopped the print from happening

End If

  • Author

Well, that's better than nothing, I guess - one extra dialog box. (I wonder why they decided that Cancel from Print could be trapped, while Cancel from Pause couldn't....)

Thanks - Chap

Well, that's better than nothing, I guess - one extra dialog box. (I wonder why they decided that Cancel from Print could be trapped, while Cancel from Pause couldn't....)

In the case of the former, you are canceling the Print script step; the remainder of the script continues running once the dialog is dismissed.

In the latter the thing that is "paused" is the script, therefore canceling the script, um, cancels the script. There's no script running, having been canceled, to capture the cancel.

....

Set Error Capture [on]

Print []

Set Variable [$error]

Set Error Capture [off]

....

That Set Variable script step should of course be:

Set Variable [$error; Get ( LastError )]

  • 1 year later...

If only the "Cancel' button for a paused script really did cancel - if it were labeled correctly it would say 'Halt'. If it actually did cancel then I could run a subscript to do the printing, let the user print or cancel, and then go about my merry way using the parent script to navigate back to where I need to be.

I can't tell you how many clients look at me funny when I tell them that they have to continue to cancel while printing. It may be filemaker's shortcoming but it's me that it makes look bad.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.