# Script on mouseClicked Button requires 2 clicks to run

**URL:** <https://forum.inductiveautomation.com/t/script-on-mouseclicked-button-requires-2-clicks-to-run/68668>\
**Category:** Ignition\
**Tags:** ignition81, database, vision, scripting\
**Created:** [January 17, 2023, 3:02pm UTC](https://forum.inductiveautomation.com/t/script-on-mouseclicked-button-requires-2-clicks-to-run/68668 "2023-01-17T15:02:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [January 17, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/script-on-mouseclicked-button-requires-2-clicks-to-run/68668/3 "2023-01-17T15:18:07Z")

</div>

> [@Drop down, change of selection](https://forum.inductiveautomation.com/t/drop-down-change-of-selection/68142/5):
>
> If you are attempting this from the mouse clicked event handler, the problem is that the event fires before the index is selected. This is why it doesn't work on the first click but does work on the second. Of course, by the second click, all of the other scripting is out of sequence. The correct way to fire this script is from the propertyChange event handler. Simply take all of your code and nest it in the following if statement: if event.propertyName == 'selectedIndex': [image]

---

_[View the full topic](https://forum.inductiveautomation.com/t/script-on-mouseclicked-button-requires-2-clicks-to-run/68668)._
