Unable to type "\\" in Run of Start menu in WinXP32 using type("\\")

Asked by Swarna Sundararaman

1. Sikuli-IDE-win-20100223

2. OS : Windows XP 32-bit SP3

3. Intention is to type in the IP of a printer to do a point-and-print installation.
    line1: click(Screencapture of 'Start' button)
    line2: click(Screencapture of 'Run')
    line3: type("\\Ip of the target printer")
    line4: click(Screencapture of 'Ok' button)

Observed behavior: Only a single '\' is taken in the 'Run' field, as a result of which the target printer is not found.
                            Shared locations also can't be accessed.

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

If its only text, that has to be written into a field on the screen, that has focus, its easier to use paste() instead of find.

your case (mixed with my experiences ;-) while testing:
setShowActions(True) # so while testing, you see whats happening
address = input("Pls. IP of printer") # as a suggestion ;-)
if address:
   click(<Start>); sleep(1)
   click(<Run>); sleep(1)
   paste("\\"+address)
   type(Key.Enter) # no need for an additional click

When it works, I comment setShowActions() away
# setShowActions(True) # so while testing, you see whats happening

and then maybe adjust timing with the sleep() values.

so may be in the end saved as executable:
address = input("Pls. IP of printer") # a suggestion ;-)
if address:
  click(<Start>)
  click(<Run>); sleep(1)
  paste("\\"+address)
  type(Key.Enter)

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

type is critical to use, if not working with a original US keyboard (it simulates key presses on this keyboard). Other layouts may produce different keys.

Your keyboard?

Revision history for this message
stefaan.himpe@gmail.com (stefaan-himpe) said :
#3

In python and jython the backslash character needs to be escaped, i.e. "\\" is really only one backslash.
You need to type

paste("\\\\"+address)

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

ok, this was the easy and most obvious answer ;-)

Sorry, for may be misleading you. Have fun.

Pls. set to solved, if it works. Thanks.

Can you help with this problem?

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

To post a message you must log in.