Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have created a scheduled task on Windows 7 which runs a Batch File at a specified interval.

This batch file in turn invokes a Perl Script. Inside the Perl Script, based on the result, I use Perl Tk to display a Popup Message which gives an Alert.

Now, while I am doing some other task on my machine, like Browsing Internet, the Browser Window will be the active window for instance. In between, the scheduled task runs and the popup Window is not displayed, instead it is minimized and displayed on the Task Bar.

Please note that I am using, htstart.exe from ntwind to avoid displaying the Console Window when the Scheduled task runs (otherwise, taskeng.exe shows up everytime the scheduled task runs).

In order to make my Perl Tk window as the active window, I am creating the window as shown below:

$mw = MainWindow->new(-background => 'blue'); $mw->focus(-force); $mw->geometry("200x200"); $mw->title("Message"); $mw->Label(-text => 'A Message', -background => 'white', -font => 'big +')->pack(); $mw->Button(-text => "Close", -command =>sub{exit})->pack(); MainLoop;

I have set the focus option so that this window becomes active.

Now, when the scheduled task runs, the only difference I observed after setting the focus option is that, the Tk Window appears in the Taskbar and it keeps blinking (probably because it is set as the active window now).

How do I make sure, that when it is displayed, it appears in the foreground and does not get minimized to the Task Bar?


In reply to Perl Tk Active Window by NeonFlash

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (6)
    As of 2018-03-20 22:21 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (260 votes). Check out past polls.