AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Toggle WASD keys to Arrow keys help

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
GamerDude
Guest





PostPosted: Sat Mar 20, 2010 2:44 am    Post subject: Toggle WASD keys to Arrow keys help Reply with quote

So... How would I make a script that toggles the WASD Keys to Arrow keys?

I have it look like this:

Code:

tab::

pressed := !pressed
If pressed {

MsgBox, 1,, Arrow Keys to WASD Keys Toggled on

w::
sleep, 10
SendInput {up down}
;sleep, 200
SendInput {up up}
sleep, 10
Return

a::
sleep, 10
SendInput {left down}
;sleep, 200
SendInput {left up}
sleep, 10
Return

s::
sleep, 10
SendInput {down down}
sleep, 200
SendInput {down up}
sleep, 10
Return

d::
sleep, 10
SendInput {right down}
sleep, 200
SendInput {right up}
sleep, 10
Return

        }



Else

MsgBox, 1,, Arrow Keys to WASD Keys Toggled off
Return


But The hotkeys work when the it's toggled on or off... How do I fix it?
Back to top
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Sat Mar 20, 2010 3:07 am    Post subject: Reply with quote

Example that uses CapsLock as the Toggle Cool
Code:
$w::
If GetKeyState("CapsLock","T")
Send {Up}
else
Send w
Return
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 3254
Location: Simi Valley, CA

PostPosted: Sun Mar 21, 2010 12:08 am    Post subject: Reply with quote

Code:
Gui, 92:+Owner
Gui, 92:Show, y-99999 NoActivate, [VxE] says to change QWEASD to H^E<v>
#UseHook

~CapsLock::Gui, % "92:" ( GetKeyState("Capslock", "t") ? "Show" : "Cancel" ), NoActivate

#IfWinExist, [VxE] says to change QWEASD to H^E<v>
;   q::Home
   w::Up
;   e::End
   a::Left
   s::Down
   d::Right
#IfWinExist ; end context-hotkeys section
Question
_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!
Back to top
View user's profile Send private message
TheGreatSwami Woo



Joined: 26 May 2011
Posts: 237
Location: uk

PostPosted: Wed Dec 07, 2011 9:04 am    Post subject: Reply with quote

@VxE
you version is great but I am not sure it is fully working?
Is there supposed to be a tooltip to let you know when you are in command mode (when capslock is down)? As it is not showing on my screen.
I would like something like
ToolTip, *** Command mode ***, 0, 0
but although I have it working in my own capslock script I dont know where to put it in yours!
ps I dont see the point of putting one line of code in code tags!
Back to top
View user's profile Send private message
jpjazzy



Joined: 16 Feb 2010
Posts: 799
Location: SciTE

PostPosted: Wed Dec 07, 2011 9:15 am    Post subject: Reply with quote

Code:
Gui, 92:+Owner
Gui, 92:Show, y-99999 NoActivate, [VxE] says to change QWEASD to H^E<v>
#UseHook

~CapsLock::
Gui, % "92:" ( GetKeyState("Capslock", "t") ? "Show" : "Cancel" ), NoActivate
ToolTip, % ( GetKeyState("Capslock", "t") ? "Arrow keys are active." : "Arrow keys disabled.")
SetTimer, TooltipOff, -2000 ; Turns off the tooltip off after 2 seconds
return

TooltipOff:
ToolTip
return

#IfWinExist, [VxE] says to change QWEASD to H^E<v>
;   q::Home
   w::Up
;   e::End
   a::Left
   s::Down
   d::Right
#IfWinExist ; end context-hotkeys section

_________________
AutoHotkey Basic - Windows 7
Back to top
View user's profile Send private message Visit poster's website
TheGreatSwami Woo



Joined: 26 May 2011
Posts: 237
Location: uk

PostPosted: Wed Dec 07, 2011 9:46 am    Post subject: Reply with quote

Thanks at first I thougnt it wasnt working but I see I had changed something from the original script, thanks
ps Love your ahknet page Cool
Back to top
View user's profile Send private message
jpjazzy



Joined: 16 Feb 2010
Posts: 799
Location: SciTE

PostPosted: Wed Dec 07, 2011 6:51 pm    Post subject: Reply with quote

Thanks. Most of that was generated by Uberi's webpage generator.
_________________
AutoHotkey Basic - Windows 7
Back to top
View user's profile Send private message Visit poster's website
Honest Abe



Joined: 07 Jan 2011
Posts: 265
Location: The American Dream

PostPosted: Wed Dec 07, 2011 7:18 pm    Post subject: Reply with quote

For those using AHK_L

Code:
#If GetKeyState("CapsLock", "T")

w::up
s::down
a::left
d::right

#If

_________________
Win7 (x64) AutoHotkey_L v1.1.05.06
Look up commands faster by using the AutoHotkey Help File's index.
Start→AllPrograms→AutoHotkey→AutoHotkey Help File
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group