There are two possible ways that your script could fail.
The If step might select the wrong branch of code if nq_PREFS::DefaultPaperSize either has the wrong value, the wrong data type or is not accessible at the time that If step executes.
The print setup step in the "letter" branch of the code may fail to correctly restore the expected settings.
If you have FileMaker Advanced, you might use the script debugger and data viewer to determine which is the case for your script. Without advanced, you could temporarily insert some Show Custom dialog steps just after the different print setup steps to show you which one is being performed when the script is executed.
And you may be interested in evaluating a plug in such as MyFmButler to get more explicit control over printer operations than is possible with just FileMaker alone.
Thanks again for your answer. I think I was able to spot what was wrong by comparing this script with a similar one. Your answer tipped me off to where the answer may come from.
Thanks for the help.
Is there any type of how-to book you could recommend that I could buy to learn how to write these elementary scripts? Is there a tutorial of any kind on this site to learn?
There are quite a few options for training that you can research. There are books available and you can check out reader reviews at a site like Amazon. There are training videos--even free ones on youtube.
I haven't reviewed/evaluated them all to be able to make a recommendation and the best option for you will depend on your personal preferences and prior knowledge and skills.