September 24, 200817 yr 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, 200817 yr by Guest
September 24, 200817 yr 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
September 25, 200817 yr 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?
April 5, 201114 yr 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.
April 5, 201114 yr Filemaker 10 doesn't count canceling print setup as an error. What leads to this (wrong) conclusion?
April 6, 201114 yr 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.
April 6, 201114 yr 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.
April 6, 201114 yr 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/
April 6, 201114 yr 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.
Create an account or sign in to comment