web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using Send Keys to sen...
Power Automate
Unanswered

Using Send Keys to send a variable that contains parenthesis

(0) ShareShare
ReportReport
Posted on by 4

I'm running into a possible bug and hoping that someone can point me towards a workaround or solution while not having to disable "Send Text as Hardware Keys". I might be missing something obvious, but I have scoured forums and documentation and am at a loss.

 

With Send Text as Hardware Keys enabled, it returns the following text:

John {(}(}Bob{)}

 

With Send Text as Hardware Keys disabled, it returns the expected result:

John (Bob) Doe

 

Steps to replicate:

1. Set new variable %FullName% with text 'John (Bob) Doe'

2. Focus window 'Untitled - Notepad'

3. Send Keys %FullName% to the foreground window

   -In this step, enable "Send Text as Hardware Keys"

 

Error Location: Subflow: Main, Action: 3, Action name: Send keys

Error Message: There isn't an active application to send keystrokes to.

Error Details:

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: There isn't an active application to send keystrokes to. ---> System.InvalidOperationException: Stack empty.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Stack`1.Pop()
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.MouseAndKeyboard.CommonKeyboardActions.SendKeystrokes(String textToSend, Int32 delayBetweenKeystrokes, Boolean sendTextAsHardwareKeys)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.MouseAndKeyboard.Actions.SendKeys.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    The tool tip help says that it performs the actual keystrokes and this doesn't seem to go well with special characters since we cannot directly type the ( without pressing the Shift modifier key. Maybe that's not the case with captial J but only with special chars.

     

    Because it uses the actual keystrokes, we shall send the actual keys too.

    So, John {Shift}(9)Bob{Shift}(0) Doe works in this case without throwing the error you are getting.

     

     

    VJR_0-1668221901085.png

     

  • dwillequer Profile Picture
    4 on at

    Interesting - I'd be curious what is causing the script to lose focus on the window in typing that particular string since it errors out before completing the line of hardware keys sent. I'll give your solution a go and see if I can get it to work for my particular scenario. I'm actually pulling in a CSV of names, so will need to figure out how to detect those parenthesis and replace them with (Shift)(9) inside the variable if that is the route I need to go. 

  • VJR Profile Picture
    7,635 on at

    Also try setting that text to Clipboard and from there writing it to the destination. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 282 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 159 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 146 Super User 2026 Season 2

Last 30 days Overall leaderboard