Shadowizoo Posted September 24, 2008 Posted September 24, 2008 (edited) Hi everyone. I got a problem using the "Print Setup" function. In one of my script I'm using the "Set error capture On" because I would like to cancel the script if the user press cancel. Is it normal that "OK" and "Cancel" from the "Print Setup" function return the same error which is 0 For the "Print" function that works fine : Is there a way to bypass this ? I use FileMaker Pro 9 advanced. Edited September 24, 2008 by Guest
Vaughan Posted September 24, 2008 Posted September 24, 2008 Are you using: Allow User Abort [off] ... Set Error Capture [on] Print Setup [] Set Variable [$error ; Get( LastError )] Set Error Capture [off] If [ $error = 0 ] End If
117Alan Posted September 25, 2008 Posted September 25, 2008 Subject: Cancel Print Setup Here are two “script” ideas that word for me if I want the option to cancel or proceed with a print script: Allow User Abort [ Off ] Go to Layout [ “H invoice” (Items) ] Enter Preview Mode Show/Hide Status Area [ Show ] Show Custom Dialog [ Title: "Printing"; Message: "Do you wish to print this?"; Buttons: “OK”, “Cancel” ] If [ Get(LastMessageChoice)=1 ] Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ] Go to Layout [ “Main” (ABP) ] Enter Browse Mode Else Go to Layout [ “Main” (ABP) ] Enter Browse Mode End If Or if you would like to know, for instance, if an invoice has been printed before, this works for me: Allow User Abort [ Off ] Go to Layout [ “Iinvoice” (Items) ] Enter Preview Mode Show/Hide Status Area [ Show ] If [ not IsEmpty(ABP::DateInvoicePrinted) ] Show Custom Dialog [ Message: ("This invoice has been printed on" & ABP::DateInvoicePrinted & ".Do you wish to print it again?"); Buttons: “OK”, “Cancel” ] Else Show Custom Dialog [ Title: "Printing"; Message: "Do you wish to print this?"; Buttons: “OK”, “Cancel” ] End If If [ Get(LastMessageChoice)=1 ] Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] Go to Layout [ “Main” (ABP) ] Show/Hide Status Area [ Hide ] Enter Browse Mode If [ IsEmpty(ABP::DateInvoicePrinted) ] Set Field [ ABP::DateInvoicePrinted; Get ( CurrentDate ) ] End If Else Go to Layout [ “Main” (ABP) ] Show/Hide Status Area [ Hide ] Enter Browse Mode End If Is this of any help to you?
mikegfy Posted April 5, 2011 Posted April 5, 2011 I'm having the same exact problem. Looking to upgrade from Filemaker 7 to Filemaker 10. Filemaker 7 sets the last error as 1 if you cancel print setup. Filemaker 10 doesn't count canceling print setup as an error.
comment Posted April 5, 2011 Posted April 5, 2011 Filemaker 10 doesn't count canceling print setup as an error. What leads to this (wrong) conclusion?
mikegfy Posted April 6, 2011 Posted April 6, 2011 Here's a simple test I made. Just run the script which consists of: Allow User Abort [Off] Set Error Capture [On] Print Setup [Restore] Set Field[test::text;Get(LastError)] I ran the script in Filemaker Developer 7 and canceled the print setup. test::text is set to 1. I ran the script in Filemaker Pro 10 advanced and canceled the print setup. test::text is set to 0. I'm sure there's a better way to program this, but I'm more concerned with the result I'm getting.
Vaughan Posted April 6, 2011 Posted April 6, 2011 I believe that it's the restore option: remove it and test again.
mikegfy Posted April 6, 2011 Posted April 6, 2011 You're right, with the restore option checked, it doesn't count as an error when canceling. With the restore option unchecked, it sets the last error as 1 when it's canceled.
comment Posted April 6, 2011 Posted April 6, 2011 Hm... looks like they changed the behavior in version 9 - version 8.5 does return error 1 even with the restore option checked. However, I am not sure which one is the correct behavior - see: http://help.filemaker.com/app/answers/detail/a_id/3199/kw/print%20setup%20restore%20error/
mikegfy Posted April 6, 2011 Posted April 6, 2011 Thanks, that's helpful. I was thinking of trying two print setups in a row, but wasn't sure if that would give me the result I wanted. Since it's recommended in the article you linked to, I think I'll give it a try.
Recommended Posts
This topic is 4978 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