Public bug reported:

So in SikuliX 1.1, there seems to be a neat new feature which
automatically sets the name of a new image capture to be same as
variable name if you capture the image while the cursor is after the
equals sign (ie, when the cursor is on the right side of "Menu = ", the
image I capture will automatically be named to Menu.png).

However, this potentially has the unintended consequence overwriting any
existing image in the bundle that already has the same name. I've
encountered this myself when I tried to set a switch of using different
images depending on the platform tied to the same variable name. Say I
intended to do something like:

if  not "10.11" in Settings.getOSVersion():
    Menu = Menu.png
else:
    Menu = Menu1011.png

When I try to do the capture for the second Menu statement, it ends up
overwriting the image in the first Menu statement because of the
automatic rename.

I think what's needed here is a check to make sure the image doesn't
already exist in the bundle before setting the name for the new image,
and using naming convention like a Menu(1).png, Menu(2).png, etc, if
there are existing ones. Or alternatively, make it an explicit option in
the Screen Capturing preferences panel so someone can disable it if it
does give them problems.

** Affects: sikuli
     Importance: Undecided
         Status: New

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

Title:
  Automatic image file names can accidentally overwrite existing images

Status in Sikuli:
  New

Bug description:
  So in SikuliX 1.1, there seems to be a neat new feature which
  automatically sets the name of a new image capture to be same as
  variable name if you capture the image while the cursor is after the
  equals sign (ie, when the cursor is on the right side of "Menu = ",
  the image I capture will automatically be named to Menu.png).

  However, this potentially has the unintended consequence overwriting
  any existing image in the bundle that already has the same name. I've
  encountered this myself when I tried to set a switch of using
  different images depending on the platform tied to the same variable
  name. Say I intended to do something like:

  if  not "10.11" in Settings.getOSVersion():
      Menu = Menu.png
  else:
      Menu = Menu1011.png

  When I try to do the capture for the second Menu statement, it ends up
  overwriting the image in the first Menu statement because of the
  automatic rename.

  I think what's needed here is a check to make sure the image doesn't
  already exist in the bundle before setting the name for the new image,
  and using naming convention like a Menu(1).png, Menu(2).png, etc, if
  there are existing ones. Or alternatively, make it an explicit option
  in the Screen Capturing preferences panel so someone can disable it if
  it does give them problems.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to