Paste() doesn't work "perfectly"

Asked by Alex on 2017-03-24


Sikuli Version : 1.1.0
OS : Windows 10 x64

I'm using Sikuli and in my script i'm using "paste(ucode("trolol;dsqjklds546$))"

The problem is that sometimes it works, sometimes not.
When it works, the text is pasted correctly.
When it doesn't the text is not pasted and the script continues like nothing happened...

What did I do wrong ?


Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #1675740.

This question was reopened

  • 2017-03-27 by Alex
RaiMan (raimund-hocke) said : #1

should have been posted as a question

RaiMan (raimund-hocke) said : #2

usually a timing problem: the GUI is not yet ready to accept the paste, because your script is too fast ;-)

put a short but sufficient wait (try wait(0.5)) before the paste()

RaiMan (raimund-hocke) said : #3

should be enough normally.

But you should somehow check/assure, that the target has focus in these cases.

BTW: give 1.1 1 a try ( is pre-final

Alex (alexboost) said : #4

I tried the 1.1.1.
It looks like everything works now =)

Thanks !

Alex (alexboost) said : #5

Thanks RaiMan, that solved my question.

Alex (alexboost) said : #6

After many test;
I still have the same problem. Even with a wait(1) or wait(0.5) before the paste
Did I do something wrong ?
Why ?

RaiMan (raimund-hocke) said : #7

Since I do not know your app situation, I can only guess:
- either a timing problem
- or a focus problem

try a type("x") before the paste, to see, wether the input field has focus.

Alex (alexboost) said : #8

OK I tried;

Sometime I got in the field :
and sometime I got :

So that's mean that the focus is good.

Here the part of the script :


Alex (alexboost) said : #9

I have to specify that, I am not starting the script from the Sikuli's GUI.
I launch it by CMD using this command : runsikulix.cmd -r path/of/my/script.sikuli

type("xxxx") works every time, the only problem is that we can't write special characters with this function.
So when I am trying to, the script failed and stop.

That's why I am using paste() associated to ucode().

RaiMan (raimund-hocke) said : #10

is it a local application or a web app?

I want to setup a testcase myself.

Alex (alexboost) said : #11

It's a local application.

The problem is that's a licensed software so you can't get it for free.

Maybe you can try with the "DEMO" version.
It's "Point de Vente G5" :

I'll keep in touch if you have questions.

RaiMan (raimund-hocke) said : #12

ok, I will try it.

Alex (alexboost) said : #13

Did you got time to try it ?

RaiMan (raimund-hocke) said : #14

sorry, not yet.

Launchpad Janitor (janitor) said : #15

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Alex (alexboost) said : #16

Did you got time to try it ?

RaiMan (raimund-hocke) said : #17

apparently not, sorry.
Will try it today.

Alex (alexboost) said : #18

No problem, take your time =)

RaiMan (raimund-hocke) said : #19

ok, I made some tests and had no problems.

It contains my testscript and as shot1 a screenshot of the dialog I was typing/pasting into.

Can you help with this problem?

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

To post a message you must log in.