Taking a screenshot always attaches unwanted digits in the filename

Asked by Cosmin Niculae on 2018-08-01

Whenever the user takes a screenshot via code, the file is appended with digits showing the date it was taken. This makes it tedious when the user has to search for an image. For example, taking saveScreenCapture("Picture.png") will always result in something like "Picture20181204". In my project, I had to write a function which takes the last file created and then rename it once again to the desired filename.

This happens on the last Sikuli version which is 1.1.2 and on a Windows 10 x64 machine.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-08-02
Last reply:
2018-08-02
RaiMan (raimund-hocke) said : #1

should first be a question

RaiMan (raimund-hocke) said : #2

I do not know the function
saveScreenshot()

as a feature of SikuliX.
So what are you talking about?

Cosmin Niculae (cnlinux) said : #3

Sorry, I meant to say save saveScreenCapture().

RaiMan (raimund-hocke) said : #4

you might use instead:

capture(SCREEN).getFile(…..)

according to this:
 /**
  * stores the image as PNG file in the given path
  * with the given filename
  *
  * @param path valid path string
  * @param name filename (.png is added if not present)
  * @return absolute path to stored file
  */
 public String getFile(String path, String name) {

Can you help with this problem?

Provide an answer of your own, or ask Cosmin Niculae for more information if necessary.

To post a message you must log in.