Robotic Process Automation (RPA)

 View Only
  • 1.  Send Key (TAB) not working with SAP Business One

    IBM Champion
    Posted Wed June 30, 2021 11:25 AM
    Edited by Vinicius Marques Wed June 30, 2021 11:26 AM
    Hi,

    I am working on a process that uses the SAP Business One application and I noticed that the command Send Key isn't sending the TAB key correctly, since it doesn't affect the the application at all. Other keys, seem to work fine. If I manually press the Tab key, the application responds accordingly, but not when the robot does it. I tried using the legacy option with different versions, but errors occur.

    Using the default mode does not return any errors, but doesn't work:
    sendKeys --keys "{TAB}"​

    Error using Legacy mode V1:
    System.Exception: Specified method is not supported.
       at yNUcJTg3Yn4P82uQ7l.j5L9nLkN1n2oLBYQNV.SendKeys(String  , Boolean  , KeyboardEmulationModes  , Boolean  )
       at WDG.Automation.Windows.SendKeysCommand.Execute(WindowsContext context)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ErrorHandler.m0nvU46Nja(Exception  )
       at WDG.Automation.Language.ErrorHandler.HandleExecutionExceptionIfNeeded(Exception exception, IAutomationCommand command)
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.vQ7xHXNECMOJPEvfGI5(Object , Object , Object )
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ScriptInterpreter.<RunCore>d__17.MoveNext()​
     
    Error using Legacy mode V2:
    System.Exception: Specified method is not supported.
       at yNUcJTg3Yn4P82uQ7l.j5L9nLkN1n2oLBYQNV.SendKeys(String  , Boolean  , KeyboardEmulationModes  , Boolean  )
       at WDG.Automation.Windows.SendKeysCommand.Execute(WindowsContext context)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ErrorHandler.m0nvU46Nja(Exception  )
       at WDG.Automation.Language.ErrorHandler.HandleExecutionExceptionIfNeeded(Exception exception, IAutomationCommand command)
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.vQ7xHXNECMOJPEvfGI5(Object , Object , Object )
       at WDG.Automation.Language.CommandInterpreter.<Run>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at WDG.Automation.Language.ScriptInterpreter.<RunCore>d__17.MoveNext()​


    I tried many different things to use the Tab key and noticed that AutoHotkey is able to send the key correctly to the application, so my suggestion would be to add the same method AutoHotkey uses as an alternative mode for the Send Key command. More information about how the default option for SendKey in AutoHotkey works is available here and here SendInput function (winuser.h).

    I'm open to suggestions as well.

    Regards,

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


  • 2.  RE: Send Key (TAB) not working with SAP Business One

    Posted Thu July 01, 2021 10:09 AM
    Hi Vinicius,

    If you just want to send the Tab key, you may also consider the Press or Release Key command instead?
    I have just tested it with below script it work fine:

    defVar --name notepad --type Window
    keyboard --type "KeyDown" --key "Tab"
    launchWindow --executablepath "C:\\Windows\\system32\\NOTEPAD.EXE" notepad=value
    focus --selector "IdAndName" --id 15 --name "Text Editor"
    click --selector "IdAndName" --controlsimilarity 100 --id 15 --name "Text Editor"
    keyboard --type "KeyDown" --key "Tab"

    ------------------------------
    Cheers,
    JENNY KHUC
    ------------------------------



  • 3.  RE: Send Key (TAB) not working with SAP Business One

    IBM Champion
    Posted Thu July 01, 2021 11:43 AM
    Edited by Vinicius Marques Thu July 01, 2021 11:46 AM
    Hi Jenny,

    Forgot to mention, but I also tried the "Press or Release Key" command exactly as you suggested:
    keyboard --type "KeyDown" --key "Tab"​


    Unfortunately, it did not work as well.

    Just a reminder: I am having this problem exclusively on the SAP Business One application.

    • Pressing Tab on SAP Business One with IBM RPA: does not work;
    • Pressing Tab on other applications with IBM RPA: works;
    • Pressing Tab on SAP Business One manually: works;
    • Pressing Tab on SAP Business One with an AutoHotkey script (detailed in the first post): works.

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



  • 4.  RE: Send Key (TAB) not working with SAP Business One

    Posted Fri July 02, 2021 10:34 AM
    Edited by JENNY KHUC Fri July 02, 2021 10:35 AM
    Hi Vinicius,

    I see, another thing you can try is to check if your attached window context is properly set. You can add a find window and attach window again, before the keyboard command.

    Unfortunately I don't have access to SAP Business One to test this currently, but I have face this issue for some other apps.

    Hope this help.

    ------------------------------
    Cheers,
    Jenny Khuc
    ------------------------------



  • 5.  RE: Send Key (TAB) not working with SAP Business One

    IBM Champion
    Posted Fri July 02, 2021 05:31 PM
    Thanks for the tip, Jenny!

    I just double checked, but with no success. Here's what I tried with the Send Key command:
    • Sending the Tab key with the "Via Current Window" parameter disabled: fail.
    • Sending the Tab key with the "Via Current Window" parameter enabled and with the right window in context: fail.

    Maybe this is an issue with the command itself?

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