Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 1PqxlF5FAWl0vMIf1YIahf
Power Automate - Power Automate Desktop
Answered

How to send key n times?

Like (0) ShareShare
ReportReport
Posted on 4 Apr 2022 14:54:00 by 12

In a loop I wish to press the down key n + 1 number of times, where n is the CurrentIndex variable of the loop. What is the idiomatic way to do this?

  • davidfvacca Profile Picture
    2 on 20 Apr 2023 at 02:58:42
    Re: How to send key n times?

    I have the same issue. I use the flow "sent keys" to type over a website.

    No matter if I use {Return:1} or {Return} it does 3 times.

    Any thoughts about it?.

  • Verified answer
    MichaelAnnis Profile Picture
    5,721 Super User 2025 Season 1 on 04 Apr 2022 at 16:21:08
    Re: How to send key n times?

    Try this:

     

    Send Keys {Down:%LoopIndex +1%}

    SendKeys {Down:3} would send it 3 times, so this should get you what you need. 

    good luck. 

  • ryule Profile Picture
    927 Super User 2024 Season 1 on 04 Apr 2022 at 15:43:33
    Re: How to send key n times?

    Ah gotcha, so maybe more like this (I used N, you would use down arrow)

     

    ryule_0-1649087000498.png

     

  • gabbsmo Profile Picture
    12 on 04 Apr 2022 at 15:33:32
    Re: How to send key n times?

    Won't this send the n key once per iteration in the loop? What I want to do is to send a specific key (Down arrow) LoopIndex + 1 times. So send down key once on the first iteration, twice on the second etc.

  • ryule Profile Picture
    927 Super User 2024 Season 1 on 04 Apr 2022 at 15:08:19
    Re: How to send key n times?

    I'm thinking it would be something along the lines of this:

    ryule_0-1649084886443.png

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Power Automate Desktop

#1
eetuRobo Profile Picture

eetuRobo 4 Super User 2025 Season 1

#2
KO-05050229-0 Profile Picture

KO-05050229-0 2

#2
stampcoin Profile Picture

stampcoin 2

Overall leaderboard