Cannot send an & key

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
petra
Posts: 4
Joined: 21. Jun 2018, 15:40

Cannot send an & key

Post by petra »

Hello,
I'm using the API to send some key strokes to my VM, for example:

Code: Select all

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?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Cannot send an & key

Post by mpack »

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.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Cannot send an & key

Post by socratis »

Why can't I find a single reference of "put_keys" in the source code or the SDK?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
petra
Posts: 4
Joined: 21. Jun 2018, 15:40

Re: Cannot send an & key

Post by petra »

Method put_keys is documented at:

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

Let me check the scancodes.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Cannot send an & key

Post by socratis »

Oh, so it's not a native VirtualBox API call! Maybe you should ask for help also in the "pyvbox" project?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply