Discussion:
How to insert "Enter" key in command
Avinesh Kumar
2011-03-12 11:55:32 UTC
Permalink
Hi,

I would like to know how to insert the 'Enter' Key as a command in
xdotool. I am using fedora 12

Thanks
Nazri Ramliy
2011-03-23 07:01:32 UTC
Permalink
Post by Avinesh Kumar
Hi,
I would like to know how to insert the 'Enter' Key as a command in
xdotool. I am using fedora 12
This works for me:

$ xdotool key KP_Enter

nazri
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Jordan Sissel
2011-03-23 07:28:47 UTC
Permalink
Post by Nazri Ramliy
Post by Avinesh Kumar
Hi,
I would like to know how to insert the 'Enter' Key as a command in
xdotool. I am using fedora 12
$ xdotool key KP_Enter
Depending on what key you really want to use, KP_Enter or Return should work
:)

-Jordan
Post by Nazri Ramliy
nazri
--
You received this message because you are subscribed to the Google Groups
"xdotool-users" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/xdotool-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
HarleyPig
2011-04-01 03:24:05 UTC
Permalink
Just so I'm clear on this, if I want to type a command and then the enter
key in a window I would need to do

xdotool type --window 1234 some command
xdotool key --window 1234 Return

right?
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Nazri Ramliy
2011-04-01 03:38:53 UTC
Permalink
Post by HarleyPig
Just so I'm clear on this, if I want to type a command and then the enter
key in a window I would need to do
xdotool type --window 1234 some command
xdotool key --window 1234 Return
right?
Enlightenment comes to those who try.

oh wait... yoda says there is no try ...

so

just do it.

:)
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
HarleyPig
2011-04-01 12:56:59 UTC
Permalink
I asked my question incompletely. I have already done and verified this
works. Doing

xdotool type command
xdotool key Return

is mildly annoying when scripting a whole series of steps. I was hoping i
was missing a simpler way to do this would be available.
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Jordan Sissel
2011-04-01 16:48:51 UTC
Permalink
Post by HarleyPig
I asked my question incompletely. I have already done and verified this
works. Doing
xdotool type command
xdotool key Return
is mildly annoying when scripting a whole series of steps. I was hoping i
was missing a simpler way to do this would be available.
The 'type' command understands special characters like newline (\n), btw.
However, it won't interpret literal "\n" (slash + n) as a newline.

This works for me:

% sleep 1; xdotool type "$(printf "hello\nworld\n")"
(the sleep is for letting me release my actual 'return' key before typing)

Or from ruby: system("xdotool", "type", "hello\nworld\n")

-Jordan
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
HarleyPig
2011-04-01 22:19:27 UTC
Permalink
I am unable to reproduce this in either the command line or my script (
http://pastebin.com/ZyLwNF78 )

xdotool type --delay 100 --window wid 'linux text'
xdotool key --delay 100 --window wid Return

works just fine, but neither

xdotool type --delay 100 --window wid "$(printf "linux text\n")"

nor

function xtype {
XTYPE="$(printf "$@")"
$DEBUG xdotool type --delay 100 --window wid "${XTYPE}"
}

xtype "linux text\n"

will work for me.
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
HarleyPig
2011-04-01 22:29:49 UTC
Permalink
I should clarify ... by not working I mean the enter key is not pressed in
the window.
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Jordan Sissel
2011-04-02 01:36:18 UTC
Permalink
Post by HarleyPig
I should clarify ... by not working I mean the enter key is not pressed in
the window.
Bizarro.

This works for me:
sleep 1; ./xdotool type "$(printf "Hello\nWorld\n")"

I do notice that it does not work if your enter/return key is currently
being pressed (hence the sleep above).

Can you confirm this behavior? If so, I can work on a hack around the
problem I see where if return is currently pressed, it doesn't work right.

-Jordan
Post by HarleyPig
--
You received this message because you are subscribed to the Google Groups
"xdotool-users" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/xdotool-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Alan Young
2011-04-02 02:22:47 UTC
Permalink
Post by Jordan Sissel
Post by HarleyPig
I should clarify ... by not working I mean the enter key is not pressed in
the window.
Bizarro.
 sleep 1; ./xdotool type "$(printf "Hello\nWorld\n")"
Of course it does. :]
Post by Jordan Sissel
I do notice that it does not work if your enter/return key is currently
being pressed (hence the sleep above).
Can you confirm this behavior? If so, I can work on a hack around the
problem I see where if return is currently pressed, it doesn't work right.
It's being run from a script ( http://pastebin.com/ZyLwNF78 ), which
includes a sleep call. I've run the following:

<power off guest> ; sleep 3 ; <power on guest> ; sleep 4 ; ./vb_install

So, there is, at a minimum of 7 seconds where the keyboard is not
being touched (and closer to 30-45 seconds while the guest machines
powers down and up).
--
Alan Young
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Jordan Sissel
2011-04-02 02:34:13 UTC
Permalink
Post by Alan Young
Post by Jordan Sissel
Post by HarleyPig
I should clarify ... by not working I mean the enter key is not pressed
in
Post by Jordan Sissel
Post by HarleyPig
the window.
Bizarro.
sleep 1; ./xdotool type "$(printf "Hello\nWorld\n")"
Of course it does. :]
Post by Jordan Sissel
I do notice that it does not work if your enter/return key is currently
being pressed (hence the sleep above).
Can you confirm this behavior? If so, I can work on a hack around the
problem I see where if return is currently pressed, it doesn't work
right.
It's being run from a script ( http://pastebin.com/ZyLwNF78 ), which
<power off guest> ; sleep 3 ; <power on guest> ; sleep 4 ; ./vb_install
So, there is, at a minimum of 7 seconds where the keyboard is not
being touched (and closer to 30-45 seconds while the guest machines
powers down and up).
--
Alan Young
Ok cool. I'll see if I can reproduce this and figure out why it's not
working.

As an unfortunate data point, a few months back, I had scripted (with
xdotool) a screencast demo of another of my project, and it types newlines
just fine :(

In the mean time, if you find more data points about it not working, please
let me know.

-Jordan
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Alan Young
2011-04-02 03:03:53 UTC
Permalink
Post by Jordan Sissel
As an unfortunate data point, a few months back, I had scripted (with
xdotool) a screencast demo of another of my project, and it types newlines
just fine :(
In the mean time, if you find more data points about it not working, please
let me know.
I wonder if it's specific to virtualbox ... I haven't tried to
actually just run it in a terminal window ... something to try later.
--
Alan Young
--
You received this message because you are subscribed to the Google Groups "xdotool-users" group.
To post to this group, send email to xdotool-users-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to xdotool-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/xdotool-users?hl=en.
Continue reading on narkive:
Loading...