Re: Cancel Executing Script

Gregory Pittman <gpittman-s/[email protected]>
Newsgroups gmane.comp.graphics.scribus
Message-ID <[email protected]>
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


___
Scribus Mailing List: [email protected]
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
http://wiki.scribus.net
http://forums.scribus.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.