Using space as a timed shift modifier

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

Using space as a timed shift modifier

14 Jun 2019, 14:19


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 /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

KeyWait, Space, T1
If ErrorLevel
  Send {ShiftDown}
  Send {ShiftUp}
  Send {Space}

; 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?
Posts: 982
Joined: 29 Mar 2015, 09:41

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

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Getfree, hendrikm, imnotgay, Jovannb, pn4265, rafaelrsss and 72 guests