# Spacebar like hotkey

**URL:** https://forum.highend3d.com/t/spacebar-like-hotkey/4854
**Category:** Maya
**Tags:** mel
**Created:** [October 25, 2003, 2:40am UTC](https://forum.highend3d.com/t/spacebar-like-hotkey/4854 "2003-10-25T02:40:53Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ranmakun](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/r/c57346/32.png) [@ranmakun](https://forum.highend3d.com/u/ranmakun)
#### Post date: [October 25, 2003, 2:40am UTC](https://forum.highend3d.com/t/spacebar-like-hotkey/4854/1 "2003-10-25T02:40:53Z")

</div>

I was wondering if it would be possible to write a script wich assigned to a key will do the same as the spacebar hotkey (one thing if I 'tap' it and another one if I keep it pressed).  
I want to do this because in linux (or at least in some setups), there is a problem with the spacebar panePop function and I can't find a solution. If I'm moving the mouse the panePop function won't work when I 'tap' the spacebar. But I discovered that if I assign the panePop function to another hotkey it works fine when I'm moving the mouse. So I wanted to write a script that would do the same, but maybe not the default way and assign it to the spacebar.  
Thank you.

---

<div class="post-metadata">

### Author: ![macaronikazoo](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/m/eada6e/32.png) [@macaronikazoo](https://forum.highend3d.com/u/macaronikazoo)
#### Post date: [October 26, 2003, 9:26pm UTC](https://forum.highend3d.com/t/spacebar-like-hotkey/4854/2 "2003-10-26T21:26:22Z")

</div>

i make a lot of my scripts work in that "dual mode". when you tap the key, it does a "default" action, and when you hold it, it brings up a menu. its not exactly like spacebar, but its similar.

have a look at [this script](http://www.macaronikazoo.com/mel/download/zooTimeSets.mel) to see how its done, but basically it works like this:

when the script is run, it builds a global variable, and sets it to zero. when the mouse button is clicked, a popupmenu is built, and the variable is set to 1. then on the button release command, it runs a proc whcih checks the global variable. if its on, it destroys the popupmenu, and assumes the user chose a command to run from the menu.

otherwise, it runs a default action (usually i try to make this default action user choosable).

so its not exactly the same, but it really makes using popupmenus faster and more powerful. by default, maya has the w, e and r hotkeys set up this same way too...

---

<div class="post-metadata">

### Author: ![ranmakun](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/r/c57346/32.png) [@ranmakun](https://forum.highend3d.com/u/ranmakun)
#### Post date: [October 29, 2003, 12:34am UTC](https://forum.highend3d.com/t/spacebar-like-hotkey/4854/3 "2003-10-29T00:34:33Z")

</div>

Well, thank you for your help, I've been trying to do some things, some alternatives using your method, but couldn't find a way to solve it. I can't find a function that will show the hotbox but don't do the panepop, the two functions are in the command "hotBox" and theres where the problem relies, I can't get the function to show the hotbox alone. Anyway, if someone can think a way to mimic the spacebar default action I will apreciate.  
Anyway, I couldn't solve the problem but all the things I tried were a good introdiction to some MEL programming.
