Robotic Process Automation (RPA)

 View Only
  • 1.  Set Screen Resolution not working on Runtime

    IBM Champion
    Posted Mon June 14, 2021 05:57 PM
    Edited by Vinicius Marques Mon June 14, 2021 05:58 PM
    Hi,

    I have been using the command Set Screen Resolution without a problem on Studio, but on the runtime machine this error is being logged when the scheduled script runs:
    System.NotSupportedException: Mode not supported.
       at WDG.Automation.Windows.SetScreenResolutionCommand.Execute(WindowsContext context)​


    This is how the command is configured:

    setScreenResolution --displayindex 1 --width 1920 --height 1080 --bpp "High"


    Monitor count indicates that there is only one monitor.
    Robot user is an admin of the machine.
    When I connect using RDP the resolution stays at 1920x1080 as expected.
    I also added a command to take a full screenshot and confirmed that the machine is staying at 1280x1024 when running scheduled.

    Any ideas on what could be going on?


    ------------------------------
    Vinicius Marques
    ------------------------------


  • 2.  RE: Set Screen Resolution not working on Runtime

    Posted Fri June 18, 2021 07:46 AM
    Hi Vinicius!
    I imagine you are using the scheduler to run this in the runtime.
    Are you enabling the option "Unlock Machine"?
    Without the Unlock Machine option, IBM RPA tries to use an already opened session. If there is no open session, the bot runs as a system account without GUI, and any command that deals with the GUI or even mouse/keyboard commands will fail.

    ------------------------------
    Lucas Lima Oliveira
    ------------------------------



  • 3.  RE: Set Screen Resolution not working on Runtime

    IBM Champion
    Posted Mon June 21, 2021 08:27 AM
    Thank you for the suggestion, Lucas.

    The Unlock Machine option is already being used. The full screenshot command I added shows that something is being displayed in the screen, although not at the desired resolution at the moment.

    I also tried executing with it disabled to force the robot to use my RDP session but it kept kicking my out of the machine anyways.

    ------------------------------
    Vinicius Marques
    ------------------------------



  • 4.  RE: Set Screen Resolution not working on Runtime

    Posted Fri June 18, 2021 08:48 AM
    Hi Vinicius,

    Windows has two session types Console and RDP, when you access the VM via RDP, the resolution is set through your machine. The bot always runs in the console session, so it can only use resolutions available in the VM configuration.
    So you probably don't have the resolution you want in the VM.
    In this case, it is necessary to call the infrastructure sector to find out which resolutions are supported by the VM or access a VM via some other connection tool (VNC, TeamViewer, Anydesk) and look at the monitor configuration.

    ------------------------------
    Angelo Alves
    ------------------------------



  • 5.  RE: Set Screen Resolution not working on Runtime

    IBM Champion
    Posted Mon June 21, 2021 08:32 AM
    Hi Angelo,

    Thanks for the answer. I am waiting for the infrastructure team to configure the resolution on the machine and we'll try executing again.

    ------------------------------
    Vinicius Marques
    ------------------------------



  • 6.  RE: Set Screen Resolution not working on Runtime

    Posted Thu July 01, 2021 01:15 PM
    To safeguard your bot script regarding screen resolution set attempts, you could use the getDisplays command.
    This command returns a list of the available displays, and each display has the following properties

    As you can see, those are the same parameters required by setScreenResolution command.
    You can use those values to verify whether the resolution you want is available, and if it isn't, then fail the execution with the proper error.

    ------------------------------
    Joba Diniz
    Product Manager
    IBM
    ------------------------------



  • 7.  RE: Set Screen Resolution not working on Runtime

    IBM Champion
    Posted Fri July 02, 2021 09:04 AM
    Hi Joba, thanks for the suggestion.

    Using the explanation given by Angelo, the problem seems to be that the Runtime bot runs on the Console session of Windows, but when I'm developing it usually happens on a RDP session. If I run the getDisplays command in Studio on a RDP session, it returns the resolution configured in RDP, but it does not guarantee that the Console session will have the same resolution available. For the displays captured by this command to be more accurate, developers probably would have to schedule a test script on the runtime machine even before starting development. Is this the recommended measure?

    By the way, I recently discovered that I can get the resolutions available in the Console session even if connected using RDP with the following PowerShell script:
    (Get-WmiObject -Class Win32_VideoController).VideoModeDescription;​


    ------------------------------
    Vinicius Marques
    ------------------------------