Cannot send an & key

Discussion about using the VirtualBox API, Tutorials, Samples.

Cannot send an & key

Postby petra » 26. Jun 2018, 13:11

Hello,
I'm using the API to send some key strokes to my VM, for example:
Code: Select all   Expand viewCollapse view
session.console.keyboard.put_keys("Hello World!")

It works fine and I see the message on a cmd.exe window on the guest machine.
However, I have 3 problems:
1. { is sent as }
2. } is sent as {
3. & is sent as ^ (^ is also ^, so I cannot send & actually)

Any idea how to send an & to my guest?
petra
 
Posts: 4
Joined: 21. Jun 2018, 15:40

Re: Cannot send an & key

Postby mpack » 26. Jun 2018, 16:12

Send the right scancode. Look up the scancode equivalents for your host keyboard layout and the layout the guest OS is configured for.

This data is being passed through a simulated keyboard, i.e. as scancodes, not as ASCII strings.

I have no use for the API myself. Does that function send separate keydown and keyup events for each character in the string? I guess it must.
mpack
Site Moderator
 
Posts: 29718
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Cannot send an & key

Postby socratis » 26. Jun 2018, 21:07

Why can't I find a single reference of "put_keys" in the source code or the SDK?
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 25291
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Cannot send an & key

Postby petra » 27. Jun 2018, 10:27

Method put_keys is documented at:

https://media.readthedocs.org/pdf/pyvbox/latest/pyvbox.pdf

Let me check the scancodes.
petra
 
Posts: 4
Joined: 21. Jun 2018, 15:40

Re: Cannot send an & key

Postby socratis » 27. Jun 2018, 10:55

Oh, so it's not a native VirtualBox API call! Maybe you should ask for help also in the "pyvbox" project?
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
socratis
Site Moderator
 
Posts: 25291
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5


Return to The VirtualBox API

Who is online

Users browsing this forum: No registered users and 2 guests