Accesing clipboard

Asked by mcklaw

Hi,

   I'm on Windows XP. I need to paste a string ("c:\windows\system32\ping .t X.X.X.X") into a xp command line shell (aka cmd.exe). I've tried using "type", but i didn't worked cos special chars (i escaped \\, but : seems odd to "type" too). I tried using "paste", but cmd recieves a ^V and it fails.

   My workaraund was to rightClick in the cmd window and do a paste (from popup menu), but first i had to copy the string in the clipboard. In the doc. figures a Clipboard object, but in the sikuli scripts gives me an error (NameError: Clipboard
). Is possible to access clipboard "directly" an how? I think i missed an import (similar to mencioned in question https://answers.launchpad.net/sikuli/+question/101774), but i don't know what is.

   PS:I workaraund this opening a notepad, pasting the string and CRTL+e (select all) and CTRL+c (copy to clipboard) and closing notepad but this is very annoying.

Thanks in advance!

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

the problem with find in the moment is keyboard mapping. the base for type is US-layout.

e.g. /
find out, what would be produced with an US layout, if you press the key, that produces / with your actual layout. use this instead. (e.g. in my german example type("&") actually produces "/" or type("6", KEY_SHIFT))

Since I'm a Mac, the \ is on the 3rd layer (shift+alt) which is not compatible with the PC environment (java error). So you have to find out yourself.

I just looked into wikipedia.org and it seems to be the key on the right just below the backspace???

The Clipboard implementation seems to be only for internal use for the paste(). It would be no help, since it saves and restores the actual content before and after. So I think your only chance to avoid your notepad solution is to find out what you have to type to get your \.

Revision history for this message
mcklaw (victor-martinez-conte) said :
#2

So,

  as i understood i've to type the letter as i was in a US-keyboard (this include / and : (doble dot) ). I think that :'s was causing the error (they correspond with a < (less than) sign.

  I'll try this night. Thank you for your help!

Saludos!

Can you help with this problem?

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

To post a message you must log in.