Paste() doesn't work "perfectly"

Asked by Alex

Hi,

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 ?

Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #1675740.

This question was reopened

  • by Alex
Revision history for this message
RaiMan (raimund-hocke) said :
#1

should have been posted as a question

Revision history for this message
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()

Revision history for this message
RaiMan (raimund-hocke) said :
#3

sleep(1)
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 (http://sikulix.com) is pre-final

Revision history for this message
Alex (alexboost) said :
#4

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

Thanks !

Revision history for this message
Alex (alexboost) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
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 ?

Revision history for this message
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.

Revision history for this message
Alex (alexboost) said :
#8

OK I tried;

Sometime I got in the field :
"XBOGOTA LONG DRYSTAR NOIR/GRIS FONCE L"
and sometime I got :
"X"

So that's mean that the focus is good.

Here the part of the script :

wait(0.5)
type("x");
paste(ucode("BOGOTA LONG DRYSTAR NOIR/GRIS FONCE M"))
wait(0.5)

Revision history for this message
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().

Revision history for this message
RaiMan (raimund-hocke) said :
#10

is it a local application or a web app?

I want to setup a testcase myself.

Revision history for this message
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" :

http://www.progmag.com/telechargements/version-demo.html

I'll keep in touch if you have questions.

Revision history for this message
RaiMan (raimund-hocke) said :
#12

ok, I will try it.

Revision history for this message
Alex (alexboost) said :
#13

Did you got time to try it ?

Revision history for this message
RaiMan (raimund-hocke) said :
#14

sorry, not yet.

Revision history for this message
Launchpad Janitor (janitor) said :
#15

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

Revision history for this message
Alex (alexboost) said :
#16

Did you got time to try it ?

Revision history for this message
RaiMan (raimund-hocke) said :
#17

apparently not, sorry.
Will try it today.

Revision history for this message
Alex (alexboost) said :
#18

No problem, take your time =)

Revision history for this message
RaiMan (raimund-hocke) said :
#19

ok, I made some tests and had no problems.

https://www.dropbox.com/s/ep4xxo8razfksvm/pasteTest.sikuli.zip?dl=0

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.