Remote Desktop Access
Remote Desktop Access is a functionality that allows to remotely capture screenshots of a virtual machine desktop and to send keyboard and mouse commands to it. With this functionality, you can programmatically connect to a remote virtual machine and run its applications as if you were sitting at the virtual machine's console. Typical uses of the Remote Desktop Access functionality are creating automation scripts for unattended operating system and other software installations, implementing automated test systems, or automating any other routine activity which would otherwise require you to physically look at the virtual machine screen and operate with its keyboard and mouse.
The functionality is supported in both Parallels C and Python APIs. C API provides additional functions that can be used to create remote desktop applications with graphical user interfaces, similar to the Parallels Management Console application. Python API contains a simplified version of the C API functionality and is best suited for writing automation scripts.
The Remote Desktop Access functionality is provided by the
prlsdkapi.VmDisplayDev class. There are three groups of methods in the class:
- Primary display capture. These functions allow to capture the primary display of the remote virtual machine. In scripts, you can take a snapshot of a screen of interest in advance and save it to a file. At runtime, you capture virtual machine screens after every interaction with it and perform a bit-by-bit comparison of the saved screen and a snapshot that you take each time. If the comparison operation determines that the screen currently displayed on the virtual machine desktop is the screen of interest, you can interact with user interface controls that it contains (keystrokes on text-based screens; visual controls on GUI screens) by sending mouse or keyboard commands to the virtual machine. The assumption is that the desktop background is static, individual windows always open at the same coordinates, have a fixed size, and contain the same number of controls and data in the same exact default state.
- Mouse control. These functions provide control over the mouse in a virtual machine. You can change the position of the mouse pointer, press and release mouse buttons, and use a scroll wheel.
- Keyboard control. These functions send a key/action code combination to the virtual machine. In scripts, you can use these functions to interact with controls on a window opened inside a virtual machine (pressing buttons, selecting options, etc.). In a typical GUI application, essential visual controls usually have keyboard shortcuts (accelerator keys) assigned to them. For example, to click a button, you can send an accelerator key combination to the virtual machine; to select/deselect a check-box, you similarly send a keyboard shortcut assigned to it, and so forth. If a control doesn't have a shortcut, then you will have to use mouse control functions to position a mouse pointer over it and clicking on it (you will have to determine the control's coordinates in advance to properly position the mouse pointer).
The use of the this functionality is not limited to the tasks described above. You can use it for anything that requires taking screenshots of a virtual machine desktop and controlling its keyboard and mouse input.
Please send us your feedback on this help page