Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7760 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Allow User Abort[off]

Set Error Capture[on]

Print Setup[]

If["Status(CurrentError)=1"]

Exit Script

End If

Go to Layout("Print")

Print[No dialog]

Hi there, i have a script that is use for printing. After user click on the button, it will display out the print setup box to let user select printer and paper size, it the click cancel button in the print setup box, the script will stop. If the click ok, then it will go to another layout and print the record.

Now my problem is if i change the Print Setup[] to Print Setup[Restore], the If statement will not working, even i click cancel button, the script will still continue. I need to set the script because i have different layout to perform different printing, some of them is print only current record and some of them print all record being browse. And i don't want to let user select themselves, so i set the script with Print[No dialog].

Is that i set the wrong error capture code?

Can somebody tell me why it will happen and how to solve it.

Regards,

Henry

Posted

I have try to remove the allow use abort[off], but it still can't work. And another thing is if i set the script become "print setup[]", it will work, after i change it to "print setup[restore]", the if statement will just like view it as false and jump to the script "Go to Layout("Print")" then continue.

I think the main problem is on the Print setup script, if you set as print setup[], then it work, but if you set as print setup[restore], ,then it will not work. I just don't know why and for the script, i really need to set it as print setup[restore].

Regards,

Henry

Posted

Allow User Abort[] only hides or displays the 'Cancel' button in the status area and disables using the Esc key to abort a script. It has no other effect within the script itself.

You have found an interesting bug that I've never before noticed. I created a test file to set a number field with Status(CurrentError) after running Print Setup[] and Print Setup[Restore]. With the 'Restore' option selected, it never creates an error. So Status(CurrentError) returns zero, as it would if you had clicked 'OK' instead of 'Cancel'. I am not aware of any way to bypass this. Anyone have a workaround?

Posted

Hello Henry,

You have two questions - 1. why is this happening and 2. how can you fix it.

1. The reason it is happening is because the Page Setup command with restore is treated as a confirmation rather than a page setup 'event' (the core page set-up event having previously been performed by the 'restore' operation). In other words, because by the time the dialog is presented to the user, the page settings have already been altered by the application of the restore parameter, the user therefore does not get to determine the page set-up per se, only to further modify it (or not). For this reason, when the Restore option is used, clicking the 'Cancel' button neither cancels (reverses) the page set-up nor returns an 'action cancelled by user' error code. All very logical if you look at it from that perspective.

2. What to do about it?!... Very simple. Place two calls to the Page Setup command in succession. Use the first to restore the settings and the second to capture the user input; thus:

Allow User Abort [Off]

Set Error Capture [On]

Page Setup [Restore, No dialog]

Page Setup [ ]

If ["Status(CurrentError) = 1"]

Exit Script

etc...

The first Page Setup [ ] command will put your saved settings into effect but will not interrogate the user. The second will then pick up those restored settings, but will be 'focussed' solely on user input, ensuring that if the user cancels, your error trap will be invoked. cool.gif

This topic is 7760 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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