[scribus] Cancel Executing Script

Gregory Pittman gpittman at iglou.com
Tue Mar 23 13:26:51 UTC 2021


On 3/23/21 6:07 AM, ZASKE Martin wrote:
> I would like to submit my +1
> 
> We regularly use the Scribus Generator for mailings and there is no
> coding error, but depending on the database and the complexity of a
> document, the script can run typically up to 20 minutes.
> 
> Sometimes we have reasons (like a power cut (Africa), or a database
> error) to interrupt such a script. Since it uses much of the processor
> capacity, and keeps jumping between windows, I never manage to cut it.
> So I have to look at my frantic computer, knowing that the entire run
> and all results will be faulty.
> 
> I could add some break dialog into the Scribus Generator, but that would
> mean that I have to confirm many times, when all is well.
> 
> So a nice, solid, red emergency-button for all scripts would be a
> valuable and welcome feature please. If possible.
> 
> 
> Or - if this feature is not important to most users - could somebody
> give us pointers how Matt and Martin could add such a feature in all
> their concerned scripts, please?
> 

Typically, when a script won't quit running, there is some continual loop going on. This is one of the reasons for saving documents before running a script. More importantly, you need to find out the source of the never-ending loop. 
I have put messageBox() into a loop that feeds back one or more variables to understand what's happening. You can also put in a valueDialog() where you give permission for the script to continue with one value and with another leads to a sys.exit.
You could also create a counter of some sort that counts the number of recursions of a loop, then exits with some excessive value.

Greg




More information about the scribus mailing list