Jump to content
Sign in to follow this  
sandyinlet

Page setup cancel error

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

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