How do you auto-type the contents of the clipboard from the host into a guest Virtual Box instance?

6

2

In the case where clipboard sharing is not possible, because there is just a console and no GUI.

Adam Terrey

Posted 2012-02-07T05:04:57.510

Reputation: 169

1Which operating system is the host? – iglvzx – 2012-02-07T07:10:17.257

soz, I'm interested in Linux/Ubuntu. But, I think it is ok to keep the question operating system nonspecific. – Adam Terrey – 2012-02-08T23:43:43.177

Answers

7

Can do that with AutoHotKey on a windows host.

I wrote this script which sends the contents of the clipboard once you press Win+v.

Save it as sendClipboard.ahk:

; win + v
#v::
  SendRaw %clipboard%

if you've installed AutoHotKey, you can execute it by double-clicking the file. a "H" icon will appear in the system tray notification area.

Now you will be able to use Win+v to send the clipboard contents as text to the active window.

NOTE: don't forget to press your HOST key, usually the right Ctrl, in order to return the focus to your host os, before using Win+v.

WARNING The script is basic and does not try to protect you from inserting eg. a big image data from the clipboard as text... so it requires you to understand and know what you are doing to make use of it.

n611x007

Posted 2012-02-07T05:04:57.510

Reputation: 5 291

0

If you cannot install Guest additions to share the clipboard, you need to create a script on the host OS that stores the clipboard text in a file in a shared folder. On the guest OS you need to create a script that reads any new file in the shared folder and types the content of the textfile.


old, false answer (may still be useful to others)

In order to enable sharing the clipboard between your guest OS and your host OS, you have to install Guest additions (How do I enable the shared clipboard in VirtualBox?).

Then you need to run a script on your guest OS that listens for clipboard changes. If you use Windows, you can accomplish something like that using AutoHotkey. The script will type the content of the clipboard as text when the content of the clipboard changes.

For Mac you would also have to use a macro program like Keyboard Maestro or iKey. And for Linux some obscure command line tool that requires an software engineering degree to understand.

user 99572 is fine

Posted 2012-02-07T05:04:57.510

Reputation: 3 173