Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Switching Keys between "Alt" "and "Space


  • Please log in to reply
11 replies to this topic
Phewer
  • Guests
  • Last active:
  • Joined: --
Hello

I have tried to switch keys between "Alt" and "Space" only in a specific application(Autodesk Maya), it seem not working. I tried it with the tutorial and other exapmles but Obviously something is missing.

Space::send, {Alt}

I checked this script seems working fine on Windows generally

Here is the script that I tried with.



#IfWinActive, ahk_class Autodesk Maya 2012 x64: untitled*
Space::send, {Alt}


(I understand I would need a little more research with this script.)

But I appreciate it if you helped me with this question.


Thank you...=)

Phewest
  • Guests
  • Last active:
  • Joined: --
I think you can simply remove ": untitled* " because that is probably your problem (it won't match your window).
Make sure that is the actual class of the window, see http://www.autohotke... ... on_Getters

In general, you can also have a look at

Sets the matching behavior of the WinTitle parameter in commands such as WinWait.
Source: http://www.autohotke...leMatchMode.htm



Honest Abe
  • Members
  • 310 posts
  • Last active: Jan 08 2015 08:56 PM
  • Joined: 07 Jan 2011
The way you wrote it spams alt when you hold space down.
You want it to simulate holding alt down, like this:

*space::
send, {alt down}
keywait, space
send, {alt up}
return

Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File


Honest Abe
  • Members
  • 310 posts
  • Last active: Jan 08 2015 08:56 PM
  • Joined: 07 Jan 2011
You might consider making a single key hold down alt and a mouse button.
That way you never have to click :-]
I use something like this in 3Ds Max,
and just tested it in Maya.


$a::
send, {alt downtemp}{rbutton down}
keywait, a
send, {rbutton up}{alt up}
return

$s::
send, {alt downtemp}{lbutton down}
keywait, s
send, {lbutton up}{alt up}
return

$d::
send, {alt downtemp}{mbutton down}
keywait, d
send, {mbutton up}{alt up}
return

[Space] produces different results than using [d] in the example above.
It seems to open the Maya's main menu after holding it for a brief period.
I'm not sure why... replacing the $ with an * solved it though,
but then space would always trigger that even with modifiers.

Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File


Alefik
  • Members
  • 2 posts
  • Last active: Mar 15 2013 03:14 PM
  • Joined: 15 Mar 2013

Hi . . . first of all, this is ver exciting because i have searched a lot for content like this! i use Maya a lot, specially modeling. And i have been getting pain in my left thumb nuckle and its because it is quite silly and not ergonomic to place the nav mod in alt for the thumb to tap when  the other fingers are at W,E,R . . . I am worried for permantent damage to my hand and need desperate help! i should point out that i am a complete and utter useless beast when it comes to all that is in the world of scripting and programing and this is why i need your help . . .. cos ive tried trust me i tried!!! i just dont speak computer!. . .  Just some of its coolest apps jajaja! mayaaa!

 

I want to switch spacebar and Alt functions. So that Spacebar becomes ALT and ALt becomes Spacebar, i have tried to script it with this autohotkey programe but it just dosent do anything . . . . i also tried Honest Abes

 

I think you can simply remove ": untitled* " because that is probably your problem (it won't match your window).
Make sure that is the actual class of the window, see {C}http://www.autohotke... ... on_Getters

In general, you can also have a look at

 

The way you wrote it spams alt when you hold space down.
You want it to simulate holding alt down, like this:



*space::
send, {alt down}
keywait, space
send, {alt up}
return

 

 

But it just wont do anything!!!! is there a chance you could paste the whole script???  I used AU3_Spy to detect the real names of the software (I use Maya 2009 cos i hate what they did to the split poly tool beyond it) Its strange that it says the name is ahk_class AfxFrameOrview80 while 2013 is QWidget and Realflow has the same one QWidget. So how would the script be to be able to have this switched hotkey mod keys in these two mayas and r.f by default? Pls heeeelp, my finger hurts and im not getting any work done and i fear if i try ill get worse and maybe permanent damage on my finger! pls if you can post the script, the whole thing itd be greatly apreciated!



Alefik
  • Members
  • 2 posts
  • Last active: Mar 15 2013 03:14 PM
  • Joined: 15 Mar 2013

I also tried the window tittle instead of the class Autodesk Maya 2013 x64

Autodesk Maya 2009 x64 Unlimited

Realflow(x86_64) 2012 . . . but it wont work



pganim
  • Members
  • 1 posts
  • Last active: Jan 30 2014 02:06 PM
  • Joined: 29 Jan 2014

Honest Abe,

 

How would you write it to have the "S" key behave like the "Alt key, but, on top of it, switching the mouse button fonctions:

 

"S" + LButton triggers the original "Alt" + MButton

"S" + MButton triggers the original "Alt" + RButton

"S" + RButton triggers the original "Alt" + LButton

 

Hope you have any idea,

Thanks



Honest Abe
  • Members
  • 310 posts
  • Last active: Jan 08 2015 08:56 PM
  • Joined: 07 Jan 2011

&

An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey.

 

http://www.autohotke...tkeys.htm#combo


Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File


ncknck
  • Members
  • 1 posts
  • Last active: Feb 27 2014 10:59 PM
  • Joined: 26 Feb 2014

The way you wrote it spams alt when you hold space down.
You want it to simulate holding alt down, like this:
 

*space::
send, {alt down}
keywait, space
send, {alt up}
return

Hi Honest Abe, can you explain why the above works and the difference to space::send, {Alt}, i just cant understand. Whats the use of the star symbol, comma after send, and the return command? And wouldnt keywait get another "space" immediately and release the alt key? Thanks!



Honest Abe
  • Members
  • 310 posts
  • Last active: Jan 08 2015 08:56 PM
  • Joined: 07 Jan 2011
Hi Honest Abe, can you explain why the above works and the difference to space::send, {Alt}, i just cant understand. Whats the use of the star symbol, comma after send, and the return command? And wouldnt keywait get another "space" immediately and release the alt key? Thanks!

 

 

*

Wildcard: Fire the hotkey even if extra modifiers are being held down.

link

 

The comma after send is optional; and I include it for style.

 

keywait makes it wait for the release of space.

link

 

return is how you end a multi-line hotkey.


Win7 (x64)
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File


shank2001
  • Members
  • 1 posts
  • Last active: Nov 14 2015 01:40 AM
  • Joined: 13 Nov 2015

I know this is an old thread. But I want to do the same thing for maya as the OP, except I want it to only affect certain windows inside Maya, but not others. Basically in the viewports, and UV editor. Not areas where I am entering text. 

 

Maya does have a ClassNN: QWidgetOwnDC4 that I could use for the 3D viewport... and for the UV editor, I can use #IfWinActive UV Editor. 

 

My question is how do I use the ClassNN to trigger my action ONLY when the mouse is over the viewport? 

 

Currently here is my code:

 

 Loop

{
    WinGet, mayaControlList, ControlList, ahk_exe maya.exe
    Loop, Parse,mayaControlList, `n
    {
        if (A_LoopField = "QWidgetOwnDC4")
        {
 
*space::
send, {alt down}
keywait, space
send, {alt up}
return
 
 
alt::space
 
}    
    }
    
     Sleep, 100
 }
 
But this applies the hotkey swap over the entire system, not just in the Maya viewport, even after Maya is closed. Any ideas? I am pretty much a noob at using autohotkey.
 
EDIT: I guess that Maya does not trigger the ClassNN as I move my mouse from the outliner to the viewport... as an example... not until I click on the viewport, so maybe it isnt even possible to do what I want above. Can anyone think of a way? Thanks.

Edited by shank2001, 14 November 2015 - 01:42 AM.


YOUCEFHam
  • Members
  • 182 posts
  • Last active: Aug 16 2016 12:53 AM
  • Joined: 14 Oct 2014

Hello, Try this
 

#NoEnv
#Persistent
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
SetKeyDelay,-1
SendMode Input
SetWorkingDir %A_ScriptDir%

if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

;///////////////////  Press Ctrl + F1 to get your working windows.  ////////////////
^F1::
WinGet, Win_Process, ProcessName, A
Win := "ahk_exe " Win_Process
Sleep, 250
return
;///////////////////////////////////////////////////////////////////////////////////

;////////////////  Switch Between Space and Alt in the Selected Windows ////////////
#If WinActive(Win)

$Space::Alt

$Alt::Space

#If
;///////////////////////////////////////////////////////////////////////////////////