vbscriptsendkeyssap-gui

Sendkeys in remote minimized machine VBS


I´m having problems with doing Shift + Enter in an object of SAP application.

This is the code I have:

If Dialog("SAP Logon 730").WinListView("SysListView32").Exist(100) Then
    Dialog("SAP Logon 730").Activate
    Dialog("SAP Logon 730").WinListView("SysListView32").Select sServer
    Dialog("SAP Logon 730").Activate    
    SendKeysShell ("+{ENTER}") 
End if

A list of server is displayed in the "Dialog" object. One must be selected (with the .Select) and then open using Shift + Enter.

The problem is that if I minimize the remote machine, the Sendkeys is not performed correctly.


Solution

  • If you minimise the Remote Desktop window (the window that displays the remote computer’s desktop), Windows switches the remote session to a GUI-less mode and doesn't display windows and controls. This means you can't interact with the desktop while the session is minimised and therefore your UFT/QTP script (that's what it looks like to me anyway) will fail.

    As a possible workaround, you can try the following steps:

    1. On your local computer, close all open Remote Desktop sessions.
    2. Launch the Registry editor (regedit.exe).
    3. Navigate to one of the following Registry keys, depending on whether you wish to modify the Remote Desktop settings only for the current user or for all users on the computer:

      HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client

      HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client

    4. Create a DWORD value named RemoteDesktop_SuppressWhenMinimized and set it to 2.

    5. Close the Registry Editor.

    Now, when you minimise the remote session on your local desktop, the GUI availability on the remote machine should be unaffected and your test case should continue to run OK.

    Hope that helps...