December 16, 200817 yr In the midst of a lengthy scripted printing routine I'm issuing the Page Setup command (to enable a choice of printers). However, if the user clicks that dialogue's Cancel button the script halts and the user is dumped on an unexpected layout. How can that Cancel button (coming from the OS itself) be trapped? Recommendations for handling this? Assistance appreciated.
December 16, 200817 yr Use Error Capture in you script. After the Page Setup step, if Last error = 1, the user canceled. Take control from there and take user to proper layout.
December 17, 200817 yr Author Use Error Capture in you script. After the Page Setup step, if Last error = 1, the user canceled. Take control from there and take user to proper layout. In this case Error Capture show a value of Zero. If I'm not stepping through the debugger I get this message: "Page Setup has been canceled. Do you wish to continue with this script?|Continue|Cancel" The problem remains unsolved.
December 17, 200817 yr The folllowing script works for me: Set Error Capture [ On ] Print Setup [ ] Set Variable [ $Error; Value:Get ( LastError ) ] If [ $Error = 1 ] Go to Layout [ “Child” (Child) ] Else Go to Layout [ “GrandChild” (GrandChild) ] End If
December 21, 200817 yr Author The folllowing script works for me: Set Error Capture [ On ] Print Setup [ ] Set Variable [ $Error; Value:Get ( LastError ) ] If [ $Error = 1 ] Go to Layout [ “Child” (Child) ] Else Go to Layout [ “GrandChild” (GrandChild) ] End If Thanks Ralph. Two things I was doing wrong. 1. Assuming If[$Error] would trap. It doesn't; Get(LastError) always returns a value, if only zero. 2. Turning on Error Capture way at the beginning of the script would carry through throughout and that I could afford to capture the error status after some additional steps. They don't. Must be done immediately before and after the Print Setup[] step. Thanks again.
December 21, 200817 yr As you discovered, error capture occurs with each script step, that's why it's often handy to store it in a variable, so you can keep going and then deal with the errors at a later point in the script.
December 21, 200817 yr You can put the Set Error Capture at the beginning of the script. It appears right before the Print Setup because that is the beginning of my little script.
December 30, 200817 yr I came across your thread when having the same problem. Apparently having the Page Setup/Print step set to [Restore] will not give an error code. Refer to; http://filemaker.custhelp.com/cgi-bin/filemaker.cfg/php/enduser/std_adp.php?p_faqid=3199&p_created=1115172695&p_sid=*PAQHGmj&p_accessibility=0&p_redirect=&p_lva=&p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZwX2dyaWRzb3J0PSZwX3Jvd19jbnQ9OSw5JnBfcHJvZHM9ICZwX2NhdHM9JnBfcHY9JnBfY3Y9JnBfcHNfYW5zX3VwZGF0ZWQ9JnBfcGFnZT0xJnBfc2VhcmNoX3RleHQ9Y2FuY2VsIHBhZ2Ugc2V0dXA*&p_li=&p_topview=1
Create an account or sign in to comment