Tutorial: Which Theme uses SAP GUI for Windows

In automatization it is very important to know specifics of the UI. E.g. you want to use OCR to detect something on the UI. For OCR makes the combination of background and foreground color a difference, is it black, white or grey or vice versa. The accuracy of the result may vary with the color combination. In SAP environments it is a user individual setting, how the SAP GUI for Windows looks like. For attended bots it could be very interesting to know, which theme they will meet. The actual SAP GUI for Windows offers a few. You can find more information about SAP GUI for Windows themes registry entries here.

Theme001

To detect the using theme I programmed a tiny workflow with an invoke code activity which detects it.

'-Begin-----------------------------------------------------------------

Try

  Dim Key As String = "Software\SAP\General\Appearance"

  Dim regKey As Microsoft.Win32.RegistryKey
  regKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(Key)
  If regKey Is Nothing Then
    ErrorRet = "Appearance key not exists"
  Else

    Dim oSelectedTheme As Object = regKey.GetValue("SelectedTheme")
    If oSelectedTheme Is Nothing Then
      SelectedTheme = 256
    Else
      SelectedTheme = CInt(oSelectedTheme)
    End If

    Select Case SelectedTheme
      Case    1 : strSelectedTheme = "SAP Signature Theme"
      Case    2 : strSelectedTheme = "Enjoy Theme"
      Case    4 : strSelectedTheme = "System Dependent Theme"
      Case    8 : strSelectedTheme = "Streamline Theme"
      Case   16 : strSelectedTheme = "Tradeshow Theme"
      Case   32 : strSelectedTheme = "Classic Theme"
      Case   64 : strSelectedTheme = "Corbu Theme"
      Case  128 : strSelectedTheme = "Blue Crystal"
      Case  256 : strSelectedTheme = "Belize Theme"
      Case  512 : strSelectedTheme = "Belize High Contrast Black Theme"
      Case 1024 : strSelectedTheme = "Belize High Contrast White Theme"
      Case 2048 : strSelectedTheme = "Signature High Contrast Theme"
      Case Else : strSelectedTheme = "Unknown"
    End Select

  End If

Catch ex As Exception
  ErrorRet = ex.Message

End Try

'-End-------------------------------------------------------------------

With the SAP GUI for Windows 7.60 changes a few of things, you can find more information about the new features at SAP Community here, especially in the context of the Belize theme. There is the possibility that automated processes have to be adapted. With this snippet you can query the theme you are using and react to it in advance.

In this context a tiny hint to an article, which I published at Linkedin some time ago, about botability. In my opinion are the High Contrast themes not a coincidence and could have a reason here too.

WhichThemeIsUsed.xaml (6.7 KB)

Alternatively you can use the GUI Info for SAP Activity from the UiPath Marketplace.

4 Likes