← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #237129]: how to use printscreen on laptop in java which requires to press the "fn" key

 

Question #237129 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/237129

    Status: Open => Answered

RaiMan proposed the following answer:
---- at comment on comment #6
Uuups, some kind of overkill ;-)

ScreenImage img = s.capture();
String tempFName = img.getFile();

//String name =
tempFName.substring(tempFName.indexOf("-")+1,tempFName.indexOf(".png"));

String name = new File(tempFname).getName()

but this does not help.

to store the temp image somewhere else:
new File(tempFname).renameTo(new File("some new filename"))

this works within the same file system

Otherwise we have
move(Path source, Path target, CopyOption... options)
from java.​nio.​file.​Files

... and with version 1.0.1 it is even easier:
String imgFName =  s.capture().getFile(targetPath, targetName)

where targetName might omit .png, which is auto-added

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.