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

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

Recommended Posts

Posted

Just thought i would share an observation about the Print Setup script step in hopes this will save you some time that i invested. If its there, i missed it when searching these forums, the net and FM help.

If you Set Error Capture [ON] before running a Print Setup script step in hopes of capturing if the user hit the Cancel button in the Print Setup dialog, beware of the following facts:

1. If you set the Print Setup script step to "Restore" print setup information, the script step will ALWAYS return '0' in Get(LastError) whether you hit the Cancel or OK button.

2. If you set the Print Setup script step to not "Restore" print setup information, the script step will return '0' in Get( LastError) if you hit "OK" and a non-zero value if hit the Cancel button.

This is in both FM 9 and 10. Don't have 11 yet.

Peace,

Dan

Posted

I have read of this before.

This may be a solution (I haven't tested it):

Create a separate script that set the print setups, set it to restore with no dialog. Say this script is called "Print Setup Tall".

My suggestion is to issue this script, which will change the print setup, then issue another print setup without restore and with the dialog showing: trap this print setup script for the cancel.

Let me know how it goes. :)

Posted

Hey Vaugn!

I did something very similar which is to put both Print Setup script steps right in a row, first the one with the restore and no dialog, then followed by the no restore and with dialog. It works just fine in that i can restore print setup with the first one and then can see if user cancelled from the second one.

Peace,

Dan

Posted

It's a good idea to keep the print setup in a separate script, and only have ONE of them for each print setup option (tall, wide etc). This is because FMP stores the print setup for each platform separately inside the step, and only sets the option for the current platform. So if you want a cross-platform solution you need to make sure all the steps are set for both.

If the solution is peppered with print setup scripts then updating them is a real time waster. Better to have just one and call is in all the other scripts.

Posted

Hi Vaughan,

I do have separate print setup scripts, one for portrait and one for landscape. I just put a no restore but with dialog print setup script step in each of the two scripts right after the ones with restore and no dialog.

That way i have just two scripts to maintain and only two scripts to call, one for portrait and one for landscape. And i get my cancel catching at the same time as these two scripts return "Get(LastError)" so i can decide what to do where i call them.

If i appear to have missed something from your last response, please do let me know.

Peace,

Dan

Posted

I suggest keep the "real" print setup scripts separate. These should only restore the setup, nothing else. Do all the error checking in the other scripts.

Allow User Abort [ on ]

...

Perform Script [ Print Setup Letter Tall ]

Set Error Capture [ on ]

Print Setup []

Set Variable [ "$error" ; Get( lastError ) ]

Set Error Capture [ off ]

If [ $error = 0 ]

Else

End If

You could, if you wanted to be uber-defensive, trap for errors in the first script and return the error in the script result and trap for it too.

Posted

Hi Vaughan,

If one will *always* be running the second print set up with no restore and a dialog, can you give me a logical reason to not put it in the print setup script?

Perhaps we have different styles of coding and that is all there is to say. But i am always open to logic when discussing logic!

Peace,

Dan

Posted

The reason is, you might have more than one script that prints... you might well end up with 10 or 20 scripts that print. You only want one script that restores the print setup so you can change it easily in all of them at once if you need to.

I experienced this recently when a solution that was built assuming it would only be run on Macs needed to run on PCs. Every Print Setup script with restore need to be check on the PC.

The first thing we did was create one Print setup script fro each option (wide, tall) and replace the naked print setup steps with this script. Then we only had to change one script to fix all the others.

Posted

Ahhh... your tenacity to help and try to save time and energy is wonderful. Thanks.

And in responding to why, i now understand that i did not explain myself clearly enough. There are ONLY 2 print setup scripts in the whole solution, one for portrait and one for landscape. Every place that prints calls those scripts to do print setup. So only two print setup scripts have to be configured on both mac and windows for the Print Setup[restore] script step.

Thanks again,

Dan

This topic is 5210 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.