1

I create MATLAB GUI. And I want to pay user's attention at some moment. For this I want to flash application icon in windows taskbar.

I tried to find solution but all I get is how to change Icon, but how to make it flash rapidly (like some window applications. For example if you install something and make active another window first one starts flashing when complete installation)?

function myProgram_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
jframe=get(handles.figure1,'javaframe');
jIcon=javax.swing.ImageIcon('myicon.png');
jframe.setFigureIcon(jIcon);

enter image description here

Mikhail_Sam
  • 10,602
  • 11
  • 66
  • 102
  • 1
    An ugly hack would be to open an invisible figure and close it right away, triggering the flash – BillBokeey Nov 14 '16 at 13:39
  • @BillBokeey can you show some example? Because I want to do it in `-OpeningFcn` so this trick can't help - my main figure still invisible – Mikhail_Sam Nov 14 '16 at 13:59

1 Answers1

3

Why not just warndlg()? Unfortunately the geniuses at StackOverflow wouldn't let me comment without 50 points.

Another option is to write a batch script for this like in here:

http://forum.winbatch.com/index.php?topic=1142.0

then call it using ! syntax in MATLAB.

Ahmet Cecen
  • 142
  • 2
  • Wow! Ahmet, I can't go by the link :( An Error Has Occurred! Sorry Guest, you are banned from using this forum! You do not have permission to access this server. This ban is not set to expire. Can you please show the code inside? – Mikhail_Sam Nov 15 '16 at 06:22
  • Ahmet! Thank you for you great improvement! I will really appreciate your help in one more problem: I Can't run this .bat file: “#definefunction not recognized as an internal or external command”. I use Win10. What the problem is? – Mikhail_Sam Nov 15 '16 at 09:08
  • Ahahaha, I didn't actually read it before you mentioned this, turns out this is a WinBatch code, not native Batch. Check this out instead, or search for something similar: [StackOverflow Question](http://stackoverflow.com/questions/3560018/triggering-taskbar-button-flash-from-batch-file) – Ahmet Cecen Nov 15 '16 at 09:35
  • You know what as I read this stuff, it looks like most of these solutions while somewhat insightful, will create and blink a new icon owned by the batch/cpp file, and not the MATLAB icon... It might be best if you defer to `warndlg` for now, at least until someone more knowledgable drops by. – Ahmet Cecen Nov 15 '16 at 09:40