3

I'm currently working on a "autotype"-script for pass. In oder to do that, I need to type the username, press 'Tab' and then type the password.

For testing I'm using the following code:

WID=$(xdotool selectwindow)
xdotool windowactivate $WID type --delay 100 "Hello World"
xdotool windowactivate $WID key --clearmodifiers Tab
xdotool windowactivate $WID type --delay 100 "Hello World" 

Then I select kate as window, but the output is Hello World8Hello World instead of Hello World Hello World. What am I doing wrong?

EDIT: As workaround you can use xte 'key Tab' from the xautomation package. But the original question still remains.

  • Have you tried with something like "\\010" (adjust amount of backslashes as needed) instead of "Tab"? Or maybe the key code of your Tab key? – Ned64 Apr 23 '17 at 13:04
  • No, but 'Tab' is a keyword, because 'tab' throws an error – nidomiro Apr 23 '17 at 13:06
  • You should simplify your commands by using windowactivate only once, and remove the --delay options, and then add --sync to the windowactivate to make xdotool wait until it is done. – meuh Apr 23 '17 at 14:34
  • I do not have xdotool and cannot therefore experiment with it. However, if you change the communication with it then the problem might go away. – Ned64 Apr 23 '17 at 14:35
  • This doesn't work as well: xdotool windowactivate --sync $WID; xdotool type "Hello World"; xdotool key --clearmodifiers Tab; xdotool type "Hello World"; – nidomiro Apr 23 '17 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.