Message Boards Message Boards


Can I abort main evaluation from ScheduledTasks (Service Link)?

Posted 8 years ago
1 Reply
3 Total Likes

FrontEndExecute[FrontEndToken["EvaluatorAbort"]] is equivalent of the menu item: Evaluation >> Abort.

It works with signals as explained in Difference between Evaluation>>Quit Kernel and Quit[].

One can use it, from preemptive link, to abort e.g. a loop:

Button["Abort", FrontEndExecute[FrontEndToken["EvaluatorAbort"]], 
       Method -> "Preemptive"]
While @ True

$Aborted (after click)

Question: I can't do this from ScheduledTasks, why?

I was expecting here that after first Print the loop will be broken (you would see cell bracket stop being highlighted, but it is still bold)

 {1, 3}, 5]
While @ True

Few notes:

ScheduledTasks are returned by Service Link: enter image description here

but I don't know why this matters.

Related topics:

Aborting from inside a ScheduledTask

Installing LinkSnooper on Windows

What are the purposes of functions in FrontEnd` context

POSTED BY: Kuba Podkalicki

Go here to read the full answer and upvote it. The final solution seems to be to use

 LinkWrite[First[$FrontEnd], FrontEndToken["EvaluatorAbort"]];, {1, 
  3}, 5]
POSTED BY: Patrick Scheibe
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract