# Why I Can't Repeat My Script's Button Action By Pressing G

**URL:** https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641
**Category:** Maya
**Tags:** mel
**Created:** [December 1, 2006, 1:55pm UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641 "2006-12-01T13:55:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [December 1, 2006, 1:55pm UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641/1 "2006-12-01T13:55:42Z")

</div>

To repeat some action in maya you press g.

Well in my script i have a button that does something(does not matter) and the g stuff does not work...

Any way to fix this or it is just the way it is?

---

<div class="post-metadata">

### Author: ![naughty](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/n/35a633/32.png) [@naughty](https://forum.highend3d.com/u/naughty)
#### Post date: [December 1, 2006, 3:59pm UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641/2 "2006-12-01T15:59:45Z")

</div>

button functions do not count as repeatable actions (thankfully!) but you can actually modify the repeatLast stack yourself using the repeatLast command.

just make your script that your button executes make a call to the "repeatLast" command.

This way you can make the "g" key repeat exactly what you want.

:nathaN

---

<div class="post-metadata">

### Author: ![ewerybody](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/e/bcef8e/32.png) [@ewerybody](https://forum.highend3d.com/u/ewerybody)
#### Post date: [December 1, 2006, 6:28pm UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641/3 "2006-12-01T18:28:12Z")

</div>

or you use a shelfButton. That does this automatically :]

---

<div class="post-metadata">

### Author: ![user\_deleted](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/u/35a633/32.png) [@user\_deleted](https://forum.highend3d.com/u/user_deleted)
#### Post date: [December 7, 2006, 8:06am UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641/4 "2006-12-07T08:06:17Z")

</div>

I added repeatLast at the and of my procedure;

But it is still the same.After executing my button's action, and then when i try to do it again with G it does not execute the proc again.

Any ideas?

---

<div class="post-metadata">

### Author: ![naughty](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/n/35a633/32.png) [@naughty](https://forum.highend3d.com/u/naughty)
#### Post date: [December 7, 2006, 10:01am UTC](https://forum.highend3d.com/t/why-i-cant-repeat-my-scripts-button-action-by-pressing-g/2641/5 "2006-12-07T10:01:46Z")

</div>

you can't just use "repeatLast" and expect it to know what to repeat, you have to specify excactly what you want to happen, this is what I meant before when I said "This way you can make the "g" key repeat exactly what you want".

CODE  
repeatLast -addCommand "makeGrass(1,0)" -addCommandLabel "Make Some Grass";

:nathaN
