<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.jeremybryansmith.com/index.php?action=history&amp;feed=atom&amp;title=Simulating_keystrokes_from_clipboard</id>
	<title>Simulating keystrokes from clipboard - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.jeremybryansmith.com/index.php?action=history&amp;feed=atom&amp;title=Simulating_keystrokes_from_clipboard"/>
	<link rel="alternate" type="text/html" href="https://wiki.jeremybryansmith.com/index.php?title=Simulating_keystrokes_from_clipboard&amp;action=history"/>
	<updated>2026-06-01T00:40:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.jeremybryansmith.com/index.php?title=Simulating_keystrokes_from_clipboard&amp;diff=370&amp;oldid=prev</id>
		<title>Jeremy at 04:28, 6 February 2021</title>
		<link rel="alternate" type="text/html" href="https://wiki.jeremybryansmith.com/index.php?title=Simulating_keystrokes_from_clipboard&amp;diff=370&amp;oldid=prev"/>
		<updated>2021-02-06T04:28:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:28, 6 February 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Notes:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Notes:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This is for creating a SH script and is for the X window system (Linux, BSD, Unix, etc). Not Windows. Don&amp;#039;t use Windows.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* This is for creating a SH script and is for the X window system (Linux, BSD, Unix, etc). Not Windows. Don&amp;#039;t use Windows.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Requires the xclip program&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Requires the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&amp;lt;tt&amp;gt;&lt;/ins&gt;xclip&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt;&#039;&#039;&#039; &lt;/ins&gt;program&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. To install (on apt-based Linux distros in this example):&amp;lt;br&amp;gt;&amp;lt;pre&amp;gt;sudo apt-get install xclip&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Requires the xdotool program&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Requires the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&amp;lt;tt&amp;gt;&lt;/ins&gt;xdotool&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt;&#039;&#039;&#039; &lt;/ins&gt;program&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. To install (on apt-based Linux distros in this example):&amp;lt;br&amp;gt;&amp;lt;pre&amp;gt;sudo apt-get install xdotool&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #!/bin/sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jeremy</name></author>
	</entry>
	<entry>
		<id>https://wiki.jeremybryansmith.com/index.php?title=Simulating_keystrokes_from_clipboard&amp;diff=369&amp;oldid=prev</id>
		<title>Jeremy: Created page with &quot;If you&#039;re like me and refuse to manually type anything, you might appreciate this trick. If you ever have to interface with a program or system that doesn&#039;t support pasting te...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.jeremybryansmith.com/index.php?title=Simulating_keystrokes_from_clipboard&amp;diff=369&amp;oldid=prev"/>
		<updated>2021-02-06T04:26:04Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;If you&amp;#039;re like me and refuse to manually type anything, you might appreciate this trick. If you ever have to interface with a program or system that doesn&amp;#039;t support pasting te...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you&amp;#039;re like me and refuse to manually type anything, you might appreciate this trick. If you ever have to interface with a program or system that doesn&amp;#039;t support pasting text from the clipboard but only supports typing keys (such as a virtual machine console, VNC, or KVM software):&lt;br /&gt;
Notes:&lt;br /&gt;
* This is for creating a SH script and is for the X window system (Linux, BSD, Unix, etc). Not Windows. Don&amp;#039;t use Windows.&lt;br /&gt;
* Requires the xclip program&lt;br /&gt;
* Requires the xdotool program&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 # Get the contents of the X clipboard with:&lt;br /&gt;
 TEXT=&amp;quot;$(xclip -o -selection clipboard)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Sleep 5 seconds before sending keys. During this period, give the application&amp;#039;s window focus so that it will receive the keystrokes&lt;br /&gt;
 echo Sleeping 5 seconds before sending keys...&lt;br /&gt;
 sleep 5&lt;br /&gt;
 &lt;br /&gt;
 # Send the keystrokes&lt;br /&gt;
 xdotool type --delay 100  &amp;quot;$TEXT&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If the keys are typed too fast for the program to catch up (maybe you&amp;#039;re typing into a serial program running at a low baud rate), you can increase the delay value from &amp;#039;&amp;#039;&amp;#039;100&amp;#039;&amp;#039;&amp;#039; to &amp;#039;&amp;#039;&amp;#039;500&amp;#039;&amp;#039;&amp;#039; (milliseconds) with &amp;#039;&amp;#039;&amp;#039;--delay 500&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
I set up a global hotkey with my window manager to run the above script.&lt;/div&gt;</summary>
		<author><name>Jeremy</name></author>
	</entry>
</feed>