sandyinlet Posted December 16, 2008 Posted December 16, 2008 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.
RalphL Posted December 16, 2008 Posted December 16, 2008 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.
sandyinlet Posted December 17, 2008 Author Posted December 17, 2008 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.
RalphL Posted December 17, 2008 Posted December 17, 2008 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
sandyinlet Posted December 21, 2008 Author Posted December 21, 2008 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.
Fitch Posted December 21, 2008 Posted December 21, 2008 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.
RalphL Posted December 21, 2008 Posted December 21, 2008 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.
Carl Smith Posted December 30, 2008 Posted December 30, 2008 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
Recommended Posts
This topic is 5808 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