← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #163944]: evaluating the contents of the Clipboard

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- You say: The first time I get the value it's a true value, after that it's a 1.
Env.getClipboard() does either return the text found on the clipboard or an empty string, if the clipboard does not contain text in the moment.

so this:
if True == Env.getClipboard():
   print "returned True"
else:
   print "it is something else"

will print "it is something else" in any cases.

Since Env.getClipboard() always returns a string, the "1" you are
talking about, is the content of the clipboard and this got there with a
previous paste.

The only workaround in the moment is (Sorry, no "reset" possible), to
not use paste() in the same script.

As long, as it is characters and numbers, you might try type() instead.

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