type(zone,string of 4 digits) gives "invalid character" message

Asked by charles boutet

Hi,
I'm trying to automate Harzing's Publish or Perish.
this software enables the user to enter two fields "year of publication" between a starting year and an ending one (typicaly 4 digits)
as i try to type(zone,string of four digits) or paste(same parameters) or type(zone,only one digits to test), i get message "invalid character, only digits are allowed".
Would anyone know how to solve this please ?

best regards

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

If you use:

type("some-image.png", "1234")

or

paste("some-image.png", "1234")

this should do what you want.

Revision history for this message
charles boutet (mnem00) said :
#2

nope, that's what i said in my question.

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

Could you post a link, where I can check it?

Revision history for this message
charles boutet (mnem00) said :
#4

do you wanna see my code ?
otherwise, you just have to download harzing's publish or perish and try ^^
it's a simple type("some-image.png", "1234") line of code :)

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

ok, understood. Thought it would be on a webpage.

What happens, if you just manually give the input focus to the respective field and then only run a

type("1234")

BTW: Windows, Mac or Linux?

Revision history for this message
charles boutet (mnem00) said :
#6

Windows 7 64 bits.
type("1234") doesn't work. same error message :/
i suppose those fields are special because other fields in same software can be writen with "type" function.
is there a way to emulate digit keystrokes one by one ?

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

That might be, did not think about that.

try with the numpad keys:

type(Key.NUM1)

(seed docs: http://sikuli.org/docx/keys.html#key-constants)

Take care for num-lock (type(Key.NUM_LOCK) together with Env.isLockOn() ).

Revision history for this message
charles boutet (mnem00) said :
#8

thank you very much. type(Key.NUMx) works great :)