Using space as a timed shift modifier

Get help with using AutoHotkey and its commands and hotkeys
csebesta
Posts: 1
Joined: 14 Jun 2019, 13:58

Using space as a timed shift modifier

14 Jun 2019, 14:19

Hello,

I have recently broken my arm, so I have been using ahk to make my life a bit easier. I have been remapping my keyboard per http edgarmatias.com /papers/hci96/, Broken Link for safety with decent success. The thing I cannot figure out though is how to get slightly more advanced modifier actions working with the space bar. I am trying to make it such that if I hold the space bar for more than 1 second, shift is active. Upon release, shift should be inactive and a space character should be sent if no other keys were pressed. Here is my current script.

Code: Select all

$Space::
KeyWait, Space, T1
If ErrorLevel
  Send {ShiftDown}
Else
  Send {ShiftUp}
  Send {Space}
Return

; Number row
Space & 6::5
Space & 7::4
Space & 8::3
Space & 9::2
Space & 0::1

; Upper Row
Space & y::t
Space & u::r
Space & i::e
Space & o::w
Space & p::q

; Middle Row
Space & h::g
Space & j::f
Space & k::d
Space & l::s
Space & `;::a
Space & Enter::CapsLock

; Lower Row
Space & n::b
Space & m::v
Space & ,::c
Space & .::x
Space & /::z
No matter what I try, I cannot get this functionality to work. Any thoughts?
teadrinker
Posts: 694
Joined: 29 Mar 2015, 09:41
Contact:

Re: Using space as a timed shift modifier

14 Jun 2019, 17:41

Hi, csebesta

Welcome to the AutoHotkey forum. Sorry about your arm. Try this code:

Code: Select all

$*Space::
   KeyWait, Space, T1
   if !ErrorLevel
      Send {Space}
   else {
      Send {Shift Down}
      KeyWait, Space
      Send {Shift Up}
      if (A_PriorKey = "Space")
         Send {Space}
   }
   Return

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Bing [Bot], gummby8, kostons, natester002, RickC, teadrinker and 178 guests