← Back to team overview

sikuli-driver team mailing list archive

[Bug 1292336] Re: Sikuli focuses the wrong application

 

** Changed in: sikuli
       Status: Fix Committed => In Progress

** Changed in: sikuli
    Milestone: 1.1.0 => 2.0.0

** Summary changed:

- Sikuli focuses the wrong application
+ [1.1.0.] WinUtil.cc: suggestions for enhancements and fixes

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1292336

Title:
  [1.1.0.] WinUtil.cc: suggestions for enhancements and fixes

Status in Sikuli:
  In Progress

Bug description:
  focusWinByAppName in WinUtil.cc attempts to use
  GetWindowModuleFileName() to search for applications by executable
  name but there are multiple bugs in that function:

  1. GetWindowModuleFileName() only works for windows owned by the
  calling process (i.e. Sikuli itself):
  http://support.microsoft.com/?id=228469

  2. GetWindowModuleFileName() returns a fully-qualified path, and I
  think looking for a substring in this path is not a good idea. Instead
  it should look at executable filename only, i.e. the last component of
  the path.

  3. focusWinByAppName does not initialise the "filename" variable and
  it does not check to see whether GetWindowModuleFileName() succeeded
  or failed, so when it fails the "filename" variable is uninitialised.

  One consequence of this is that if I run Sikuli from a path containing
  the word "Foo" and then I try to call App.focus('Foo') with the
  intention of focusing an application with that word in the title bar,
  Sikuli may set the focus to the wrong window, depending on the order
  of windows returned by EnumWindows().

  I am using Sikuli IDE 1.0.1 on Windows Server 2008 R2 (64-bit).

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1292336/+subscriptions


References