Trying to use pyautogui.typewrite with VirtualBox

This is for discussing general topics about how to use VirtualBox.
Post Reply
YungSheep
Posts: 1
Joined: 3. Nov 2017, 08:18

Trying to use pyautogui.typewrite with VirtualBox

Post by YungSheep »

I'm trying to have my host computer type input to my VirtualBox. I've turned off Auto Capture Keyboard, but I'm still having trouble getting pyautogui.typewrite to input keystrokes and words/letters onto the VirtualBox. I know that the computer takes host of the keyboard while being clicked on, but I'm not sure how I can have a 3rd party program (such as python script) input characters into the VirutalBox. Is there an alternative way to programatically enter information onto the screen from a host computer? Is there an option I'm missing to get my technique to type characters and keystrokes to the VM?
PhoebusG
Posts: 3
Joined: 21. Feb 2020, 12:38

Re: Trying to use pyautogui.typewrite with VirtualBox

Post by PhoebusG »

After some searching and having the same issue myself I am now just using os.system(cmd) to pass messages to the VM with:

VBoxManage.exe controlvm "VMname" keyboardputstring StringGoesHere

More info for reference: On chapter 8 of the manual.

"To save future google searches going unmet..."
PhoebusG
Posts: 3
Joined: 21. Feb 2020, 12:38

Re: Trying to use pyautogui.typewrite with VirtualBox

Post by PhoebusG »

For larger directories you're bound to run into spaced in windows path names, so use this instead:

import subprocess
cmdCommand = "python test.py" #specify your cmd command
process = subprocess.Popen(cmdCommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
print output
Post Reply