Can I reset an InDesign dialog?

I have a script for InDesign that imposes PDF files on a press sheet. It starts by having InDesign make a dialog for the user to enter values in. If the user enters a value that won’t work, after the dialog is dismissed the script warns them, then reopens the dialog so they can try entering their values again (and correct their mistake). My problem is after the new values are entered and the dialog dismissed, if the page rotation option in the dialog was used, the script won’t place rotated frames. It places all frames on the press sheet unrotated and doesn’t warn the user of the problem.

I’ve tried resetting the rotation value to be empty before opening the dialog the second time, but that doesn’t resolve the issue. Does anyone know if what I’m trying to do is possible with InDesign created dialogs or do I just need to terminate the script after the user dismisses the error alert and have them rerun the script from scratch?

Are scripting an existing InDesign dialog or have you created a custom dialog with your script?
Either way, should be possible to reset tp get desired rotation.
Hard to tell where the issue is without seeing the code,

Did you set a breakpoint at the trouble area in Debug mode and Step thru it shecking your variables at each step to see if they are updating as expected?

You said you set the rotation value to empty, maybe it needs to be 0 to over-ride previous setting? just a wlld guess.

It’s a custom InDesign dialog created in the script. In the script, the rotation returns true or false depending on a checkbox.

I had run it with debugging turned on and the rotation value does get updated as expected. This is part of what was puzzling me. However after seeing your reply to my question, I ran it with debugging on a couple more times and now I see where the problem is occurring. If the dialog is reopened and new values entered, once the dialog is dismissed the script is returning to the spot where the original error occurred, which bypasses the earlier checks for valid user-entered values. So the script happily uses the incorrect values.

So I need to figure out how to get the script to return to the first place where the dialog is called so all checks for valid input are run. Thank you for your input. Didn’t solve my problem but got me looking the right direction I believe.

Cool! I would turn the section that does the checking into a function and then call it from the first location and again from the second spot when error conditions have been met.