DONE: New command for (long running) scripts

Make a request or discuss new features.
Post Reply
User avatar
pjj
Posts: 2192
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

DONE: New command for (long running) scripts

Post by pjj »

I have some scripts that run on a text file and, depending on its size, it takes them 10+ sec to finish. Usually I start them with

Code: Select all

ShowMessage("Starting document clean-up…");

// turn off screen updating
Document.BeginUpdate();

// turn word-wrap off
if (Document.Wordwrap) {
    Document.Wordwrap = false;
}
and end with

Code: Select all

// turn on screen updating
Document.EndUpdate();

ShowMessage("…Done!");
("Document cleanup" is just a particular function one of them does [cleaning up HTML cruft], I used it here as an example.)

There's a key combo to halt a running script, but I usually can't remember it. -- Now, could we have a new command, that would single-handedly:

a) spawn a modal window with script's file name and a button to stop it

b) turn off screen updating and word-wrap

and after the script has been run

c) close the window and show message "Script completed successfully" and [ OK ] button

This way there will be some visual feedback to the unresponsive editor ("wait a sec, the editor is running a script") and a handy way to stop the script. If the script is hung etc., appropriate message could be displayed on the window.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
pjj
Posts: 2192
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: New command for (long running) scripts

Post by pjj »

When debugging (stepping over the script), Document.BeginUpdate() command should be automatically discarded, of course.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
Rickard Johansson
Site Admin
Posts: 6731
Joined: 19 Jul 2006 14:29

Re: New command for (long running) scripts

Post by Rickard Johansson »

Added a non-modal dialog that is displayed after a few seconds (if the script is still running).
It gives the option to abort the script, or close the dialog.

(A modal window can't be used since the script can show modal dialogs of its own)

Done in next version (v16.26).
Post Reply