Basically, here's what I've got so far. I've got a perl script which will be run remotely, by many networked computers simultaneously (dozen+). I've been testing the script to verify that it works - and it works great, at least for one computer. I haven't tested multiple computers as I don't have them available to me as of right now (and since it's a race condition, even if I run the tests it may not even show up). So, what I'd like to know is if running the following code would have the possibility of a race condition (send the keys to the wrong window):

... (unnecessary code) my @windows = FindWindowLike(0, "$uniquename", ""); for (@windows) { SetForegroundWindow($_); SendKeys("^{CAPS}"); } ... (unnnecessary code)

Each window being tested will have a unique name, so FindWindowLike will be returning exactly the window I want (silly for loop, I know). So could it send it to the wrong window? If so, what could one way be of fixing this, perhaps WaitWindow?


In reply to Is GUITest SetForegroundWindow/Sendkey thread safe? by MPQC

Title:
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, details, 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, summary, 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.