|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Tue Jul 13, 2010 5:58 pm
Detect key being held down? |
I've looked through the help and can't find anything, so I'm guessing it's not possible...
I'd like to be able to detect if a key (alt or control for instance) is held down.
Either by a function or variable I can use, or a way of having a class enabled only while the key is held down.
Is there any way I can do this? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jul 13, 2010 6:08 pm |
Nope.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jul 14, 2010 6:55 pm |
About the only way to do anything like this is in the 3.x Beta version where you can create Buttons that execute different scripts based upon which mouse button and which "shift state" is used to click the button. For example, you can create a button that executes a different script if you hold down the SHIFT key when clicking the button. That's about as close as you can get, sorry.
Otherwise you'd have to write a COM DLL library that adds this functionality, which requires a pretty knowledgeable programmer. |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Wed Jul 14, 2010 9:16 pm |
Check into a program called AutoHotkey Moo. With a bit of imagination and time I believe this will accomplish what you want within CMUD. I haven't used it in a while or with CMUD for that matter, but I have done similar things with it and other programs.
|
|
_________________ Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34 |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: Sat Jul 24, 2010 2:28 am |
Got around to swapping my AutoHotkey installer over to this Vista machine and it appears to work well so far, not sure how it would do with Win7, but it appears to play nice with CMUD. Below is the link where the small program can be found and an example of how you could use it to enable classes while certain keys were pressed down.
http://www.autohotkey.com/download/ Download link.
Copy and paste the following code block into a text editor and save to AnyFileNameYouWant.ahk onto your desktop where you can reach it easily. The .ahk extension marks the file as an AutoHotkey script which can be executed when double clicked.
Code: |
RCtrl::
SendInput {#}T- Class_1{Enter}{#}T{+} Class_2{Enter}
KeyWait, RCtrl
SendInput {#}T- Class_2{Enter}{#}T{+} Class_1{Enter}
return |
1. Open CMUD to a blank untitled session.
2. Press Ctrl+G.
3. Highlight the untitled window in the Package Editor.
4. Click on the XML tab at the bottom of the Editor.
5. Paste the following into the XML window.
Code: |
<window name="untitled">
<uid>{189D4896-7EAC-4B2B-A43D-3D30FD973F19}</uid>
<packages>untitled</packages>
<class name="Class_1" id="1">
<alias name="test" id="3">
<value>#show {Alias just fired for class 1}</value>
</alias>
</class>
<class name="Class_2" enabled="false" id="2">
<alias name="test" id="4">
<value>#show {Alias just fired for class 2}</value>
</alias>
</class>
</window>
|
6. Click save and close the editor if you want.
7. Now double click the .ahk file you created on your desktop to enable the script.
8. On the command line of the untitled window type test and hit enter (Notice the displayed message)
9. Now either retype test and press the right Ctrl button and hit enter or just press the right Ctrl button and hit enter if your command line isn't set to auto clear. (You should now see a different message displayed to the screen)
You can also see the results of this simple script enabling and disabling the classes if you keep the Package Editor open, while pressing the right Ctrl key.
Just be sure to always have you command line in focus or strange things might happen depending on how you edit or change the script.
Sorry it took me so long to get back to this but it's been kind of a busy week. Once installed the program is only like two and a half MB worth of disk space, has tons of other uses, and is free on top of all that. Also if you ever get stuck with out a copy of your favorite client around the help file will tell you how to convert the .ahk file in to an executable that can be carried on a flash drive to make use of aliases and macros while using basic telnet. |
|
|
|
Moo Apprentice
Joined: 10 Apr 2009 Posts: 145
|
Posted: Sat Jul 24, 2010 1:40 pm |
Thanks.. I have actually used ahk before, but I thought it was a bit overkill for something that should be very simple in cmud.
|
|
|
|
|
|