type(xxx,Key.DELETE) don't delete highlighted text

Asked by David ENJOLRAS

in Notepad, enter "ThisIsaTest" and double click on it in order to get it selected

with sikuli, run type(<image of the text highlighted>,Key.DELETE)

instead of having deleted the selection, only 1 char have been removed ?

type(<image of the text highlighted>,Key.SHIFT+Key.DELETE)
is even "strange": it replace the text by a number ???

How to delete the whole highlighted text ?

Question information

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

type(<image of the text highlighted>, Key.DELETE)

would position the cursor somewhere in the middle of the text and then delete the character next to it.

To select the text, you have to simulate the respective keys, that select a text and then issue the delete:

e.g.
doubleClick(<image of the text highlighted>)
type(Key.DELETE)

or if the text is already selected simply
type(Key.DELETE)

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

Be aware:
type(someTarget, someKeys) is resolved in a sequence of

click(someTarget)
type(someKeys)

and hence resets an existing selection.

Can you help with this problem?

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

To post a message you must log in.