# Auto click button on Dashboard-ui

**URL:** https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120
**Category:** Dashboard
**Created:** [5 March 2021 20:53 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120 "2021-03-05T20:53:03Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![justsimo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justsimo/32/38315_2.png) [@justsimo](https://discourse.nodered.org/u/justsimo)
#### Post date: [5 March 2021 20:53 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/1 "2021-03-05T20:53:03Z")

</div>

Hi y'all, i hope you can help me.  
I have my 'node-red-node-ui-microphone' set on my dashboard and i'd like to "autoclick" it every 5 seconds. How can i click 'Start' and then stop it after 5 seconds (then restart it again)?  
I'd like to have a 5 seconds' rec, 5 seconds pause and then restart another registration.  
This registration will go in my 'Speech to text' node (IBM Watson)

![Cattura](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bde297da70802c7671fdea718ec748c25345c4c4.png)

![Cattur3253523a](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/3/d3dc703f81a243f3b29487de723031f9175dfc43.png)

I don't know how to do because Microphone-ui doesn't have input wire. Should i use Javascript or something like that?

At the end: i need a loop but this loop must be on clicking the button every 5 secs (i cant use inject or something like that ☹ )

Thank you so much! I hope you get my problem or i'll try to explain it better 🙂

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [5 March 2021 21:51 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/2 "2021-03-05T21:51:31Z")

</div>

Currently there is no way to do that in a flow with that node.

If you need longer recording, there is a beta node that you might be able to use [node-red-contrib-sox-utils](https://discourse.nodered.org/t/update-node-red-contrib-sox-utils-beta-0-4-5/40017)

---

<div class="post-metadata">

### Author: ![linhtranvu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/linhtranvu/32/30053_2.png) [@linhtranvu](https://discourse.nodered.org/u/linhtranvu)
#### Post date: [6 March 2021 02:20 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/3 "2021-03-06T02:20:56Z")

</div>

This could be done with js

Create a temple node and write js target microphone dom. It has a node-id attribute so you could easily find DOM and emulate its action inside a setInterval function

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 March 2021 08:47 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/4 "2021-03-06T08:47:37Z")

</div>

Maybe, give it a try.

---

<div class="post-metadata">

### Author: ![justsimo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justsimo/32/38315_2.png) [@justsimo](https://discourse.nodered.org/u/justsimo)
#### Post date: [6 March 2021 13:02 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/5 "2021-03-06T13:02:58Z")

</div>

Could you help me with this? Should i take an inject and wire it with template node?  
Then i should put something like this `setTimeout(document.getElementByID('ui_microphone').click(),5000);` ?

---

<div class="post-metadata">

### Author: ![justsimo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justsimo/32/38315_2.png) [@justsimo](https://discourse.nodered.org/u/justsimo)
#### Post date: [6 March 2021 14:09 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/6 "2021-03-06T14:09:50Z")

</div>

There is a way to put an input to a node even if it doesnt have it?  
Like Microphone-ui doesn't have input, i would use it just for looping it every 5 seconds.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 March 2021 17:37 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/7 "2021-03-06T17:37:46Z")

</div>

What part of my first reply did you not understand?

---

<div class="post-metadata">

### Author: ![linhtranvu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/linhtranvu/32/30053_2.png) [@linhtranvu](https://discourse.nodered.org/u/linhtranvu)
#### Post date: [8 March 2021 04:10 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/8 "2021-03-08T04:10:43Z")

</div>

Just write directly in template node (template UI node) with tag

---

<div class="post-metadata">

### Author: ![justsimo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/justsimo/32/38315_2.png) [@justsimo](https://discourse.nodered.org/u/justsimo)
#### Post date: [8 March 2021 19:00 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/9 "2021-03-08T19:00:54Z")

</div>

I tried like this:

```auto
<script>
    setInterval(function() {
  document.querySelector("button.nr-ui-microphone-button.md-button.md-ink-ripple").click()
}, 5000);
</script>

```

What i'm doing wrong? i put \<button class=nr-ui-microphone-button md-button md-ink-ripple etc.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 April 2021 19:01 UTC](https://discourse.nodered.org/t/auto-click-button-on-dashboard-ui/42120/10 "2021-04-07T19:01:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
