6
$\begingroup$

I have a somewhat long computation running in the background. I would like the Mathematica icon on the taskbar to flash once the computation is done. For example, Microsoft Outlook reminders make the taskbar flash:

enter image description here

How can I achieve the same effect in Mathematica? Is there a Mathematica command that makes the Mathematica icon in the taskbar flash?

What I've tried: Beep[] can be useful, but if you leave the computer for a while, you can miss the beep. The advantage of flashing is that it remains flashing indefinitely. Another alternative is MessageDialog[], but you have no way of knowing that a message is up if Mathematica is minimized. It would be useful if MessageDialog[] produced the flashing in the taskbar, but that doesn't happen.

Update: Opening a SystemDialogInput is a hammer type of solution, although it gets the job done. I am reopening this question in case someone else comes up with something more subtle. The goal is to have some sort of alert that doesn't stop (like a beep would), so that if I leave the computer, when I return I could instantly see if the computation is done.

By the way, I am on Linux Mint, in case someone wants to get really low level :)

$\endgroup$
  • 1
    $\begingroup$ I don't think there are some commands that make the icon flash, but I usually add Beep[] at the end of code if it will take long time to compute. $\endgroup$ – mmjang Jan 14 '14 at 16:20
  • $\begingroup$ @mm.Jang The problem with Beep[] is that if you leave the computer for a while and return, and you can miss the beep. The icon flashing remains flashing indefinitely. $\endgroup$ – becko Jan 14 '14 at 16:25
  • 5
    $\begingroup$ This is OS dependent and not specific to Mathematica. You might have better luck on Super User. If you're trying to set up a notification when the computation is finished, then you can perhaps use my answer here: Automatic e-mail/text message when a calculation has finished? $\endgroup$ – rm -rf Jan 14 '14 at 16:33
  • 1
    $\begingroup$ I'm running Mac OS X and if Mathematica is hidden then using SystemDialogInput["FileSave"] makes the Dock icon bounce. Perhaps under Windows it will flash the Taskbar icon? $\endgroup$ – MikeLimaOscar Jan 14 '14 at 17:06
  • 1
    $\begingroup$ @becko What rm-rf meant (I believe) is that since Mathematica does not contain built-in functionality for this, the question would be the very same for any other software: how do you make the taskbar button of a particular program flash? Not meaning to say that this should be closed here (it would be very useful to have what you're asking for), but you are indeed more likely to get an answer on superuser.com. $\endgroup$ – Szabolcs Jan 14 '14 at 19:09
9
$\begingroup$

This is perhaps not a completely satisfactory solution but it is Mathematica based.

Unlike MessageDialog[]

SystemDialogInput["FileSave"]

will make the Taskbar icon flash in Windows and the Dock icon bounce in Mac OS X under certain conditions. (I believe the document must be minimised in Windows or hidden in Mac.)

Of course it has the slight side-effect of bringing up a file selection dialog but this could be used to ensure that the results of your long computations are saved to a file, e.g.

result = MyLongComputation[];
Export[SystemDialogInput["FileSave", WindowTitle -> "Computation Complete"], result]

Using the WindowTitle option should also make the sudden appearance of the dialog box less likely to be confusing.

$\endgroup$
  • $\begingroup$ +1 Good idea. Converting the file selection dialog into something useful makes sense. $\endgroup$ – becko Jan 15 '14 at 14:41
2
$\begingroup$

You can achieve this by upgrading to Mathematica 11 :)

$\endgroup$
  • 4
    $\begingroup$ The requested behavior is built into v11 on Windows. So depending on your point of view, it does actually answer the question. $\endgroup$ – ihojnicki Nov 18 '16 at 21:51
  • $\begingroup$ How exactly? I have Mathematica 11. Note that I am on Linux Mint. Are you saying that in Windows, MessageDialog flashes the taskbar? Please expand. $\endgroup$ – becko Nov 18 '16 at 21:51
  • 3
    $\begingroup$ @becko Just evaluate Pause[10] and task switch to some other app. The icon should flash after roughly 10 seconds. $\endgroup$ – ihojnicki Nov 18 '16 at 21:53
  • $\begingroup$ @becko This behavior does not exist on Linux in v11. I can forward that on if you are interested... $\endgroup$ – ihojnicki Nov 18 '16 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.