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 / Move mouse to image "o...
Power Automate
Answered

Move mouse to image "occurrence" field as a variable

(0) ShareShare
ReportReport
Posted on by 19

I am trying to get mouse pointer to n'th image on the screen dynamically using a valiable. The field only takes positive whole numbers as input. Is there a way to use %loopindex% and have it in a loop ?

 

parthap_0-1719691377565.png

 

I have the same question (0)
  • Verified answer
    eetuRobo Profile Picture
    4,539 Super User 2026 Season 1 on at

    Yeah for some reason the action does not support variables in edit view.
    What I found to work was to copy the action on your clipboard and pasting it into a code editor like Visual Studio Code.
    Copy:

    eetuRobo_5-1719722020651.png

    Paste:

    eetuRobo_6-1719722056152.png


    Then find the "Occurence" in it (its in first row where there are other settings for the action):

    eetuRobo_1-1719721286204.png


    Change the 1 to the text of your variable so in your case LoopIndex (without the percent signs around it)

    eetuRobo_2-1719721342691.png


    Then Copy all of the code again from the code editor and paste it into your PAD flow. Then a new Move mouse to image -action should appear (unless you edited something wrong in the actions code).

    eetuRobo_3-1719721427032.png



    Downside to this is that you cant see the variable in the Occurrence field in Edit

    eetuRobo_4-1719721459196.png


    And so if you want to change to a different variable you need to do it in code editor again.

    You can also just try copying this action and pasting it in to your flow. Its set to have Occurrence variable be %LoopIndex% like you mentioned. It will give error since there is no image selected so just pick your image and it should work.

     

    MouseAndKeyboard.MoveMouseToImage.MoveMouseToImage Images: `` SearchForImageOn: MouseAndKeyboard.SearchTarget.EntireScreen MousePositionOnImage: MouseAndKeyboard.PositionOnImage.MiddleCenter OffsetX: 0 OffsetY: 0 Tolerance: 10 MovementStyle: MouseAndKeyboard.MovementStyle.Instant Occurence: LoopIndex Timeout: 5 SearchAlgorithm: MouseAndKeyboard.ImageFinderAlgorithm.Legacy X=> X Y=> Y

     



  • parthap Profile Picture
    19 on at

    Thank you very much. Confirming that it worked perfectly. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard