Sticky Shift

Post your working scripts, libraries and tools
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Sticky Shift

15 Feb 2017, 22:57

Sticky Shift allows you to press Shift, and then release, and then the next letter will be shifted. This is substantially easier on your hands and fingers. Pressing Shift+Letter at the same time (as a chord) is the normal method, and its way less ergonomic, and timing is also an issue, because you have to press and release both keys at the correct time, otherwise you may get typos, especially at higher speeds.

I didn't like the built-in Windows feature for Sticky Keys, it kept pissing me off: I just wanted to use it for Shift, not the other modifiers such as Ctrl or Alt. I found another script and have modified it, and added the option that a double Shift = CAPSLOCK

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by guest3456 on 15 Nov 2017, 23:39, edited 4 times in total.

Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

16 Feb 2017, 18:19

Very good! I did not manage to break it :lol:
Good commenting of the code, makes it really easy to follow.
I like the skip_spacebar option, perfect if you get over eager after terminating a sentece with a period, and then starts the next one with a shift before the space.
This post was made this Sticky Script :)

Edit: Additionally, I like that it is idle until you actually use it.
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

16 Feb 2017, 20:18

Lol thanks. Yours will likely be way more advanced

Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

17 Feb 2017, 03:36

I don't think I'll continue with it, I think it's redundant, yours can easily modified to do sticky anykey, and as I mentioned, it is idle until you activate the sticky, I prefer that. The only thing that could warrant using other methods is if you want context sensitive specific keys. Eg, if you have both ctrl and shift as sticky key, then I wouldn't want ctlr to work with w in my browser, there would be to high risk that you hit ctrl instead of shift when typing, then you get ctrl+w, which closes the tab, at least in my browser. I would only want physically holding ctrl+w to work, not sticky ctrl+w.
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

18 Feb 2017, 17:42

I've updated the script in the OP.

I've added the option to display an on-screen indicator showing while the Shift is active


Helgef wrote:I don't think I'll continue with it, I think it's redundant
Well others may be interested in another technique. You could always just post your work-in-progress in this thread

Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

18 Feb 2017, 18:13

guest3456 wrote: You could always just post your work-in-progress in this thread

Perhaps, but then I'd probably start poking at it again :|

Edit: Nice pop-up! :thumbup:
User avatar
jeeswg
Posts: 4283
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Sticky Shift

19 Feb 2017, 11:47

I use this sometimes so I can drink a cup of tea/coffee while typing.

Code: [Select all] [Download] GeSHi © Codebox Plus

$Shift:: ;anywhere - capitalise without holding shift
Input, vText, L1 T1 I
if (ErrorLevel = "Timeout")
Return
SendInput +{%vText%}
Return

I also use win+space sometimes to capitalise the last word:
(To change capitalisation for the last word.)

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

06 Mar 2017, 08:24

Helgef wrote:
guest3456 wrote: You could always just post your work-in-progress in this thread

Perhaps, but then I'd probably start poking at it again :|


I think your script would be worthwhile to post. Mine has the DOuble caps problem if you hit the keys too fast (such as almost simultaneously). I'm using Input, L1 but I still can't eliminate the problem. I think the time between the Send, {Shift down} and Send, {Shift up} is just too long. And other keypresses are getting caught. But I believe I tried Send {Shift Down}{%key%}{Shift Up} but that was causing the first char to be missed like tHis. Maybe you have an idea how to fix that and still keep it idle?

Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

06 Mar 2017, 11:36

Hi.
guest3456 wrote:I think your script would be worthwhile to post.

I'll have to review which version is most acceptable first. I will (probably) post it later then.
guest3456 wrote:Mine has the DOuble caps problem if you hit the keys too fast (such as almost simultaneously).

I actually manage to reproduce the problem now, with your current script. But it's not that easy.
guest3456 wrote: I think the time between the Send, {Shift down} and Send, {Shift up} is just too long

That would be my guess too.
guest3456 wrote:But I believe I tried Send {Shift Down}{%key%}{Shift Up} but that was causing the first char to be missed like tHis

I think that the Input,... line (disregarding the idle waiting) takes the most time between Send, {Shift down} and Send, {Shift up}. So I guess, in both cases, your are most likely hitting two buttons while the input command is either preparing for or handling your keyboard input. So in the DOuble case, shift is down, and in the tHis case shift is not down, t is just typed out, while key:=h, hence the result. Maybe that's not readable, sorry :crazy:
guest3456 wrote:Maybe you have an idea how to fix that and still keep it idle?

Not really. :cry:

jeeswg wrote:I also use win+space sometimes to capitalise the last word:

That is nice jeeswg :thumbup:
Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

06 Mar 2017, 18:25

@guest3456, if this version works, I think it is my best attempt, I have made it more idle, and tried to prevent the DOuble issue.

@Anyone who wants to try it, the class with examples showing how to use it are included in:
StickyKeys.ahk
(7.67 KiB) Downloaded 83 times

In summary:
  • Make any key sticky.
  • Combine sticky keys. That is, for example, you can press and release, shift then ctrl then hit a to get a shift+ctrl+a.
  • Combine sticky keys can be turned off, then turning on a sticky key turns off any sticky key previously turned on. :wtf:

Good luck.
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

06 Mar 2017, 19:20

Helgef wrote:@guest3456, if this version works, I think it is my best attempt, I have made it more idle, and tried to prevent the DOuble issue.

@Anyone who wants to try it, the class with examples showing how to use it are included in:
StickyKeys.ahk
In summary:
  • Make any key sticky.
  • Combine sticky keys. That is, for example, you can press and release, shift then ctrl then hit a to get a shift+ctrl+a.
  • Combine sticky keys can be turned off, then turning on a sticky key turns off any sticky key previously turned on. :wtf:

Good luck.


It works well.

Minor issues:

1. I still got the DOuble issue, but much much less frequently than my script. I pretty much have to press the letters simulatenously, which is hard to do
2. When CAPS is on, the Shift should then be a lowercase letter

Helgef
Posts: 2901
Joined: 17 Jul 2016, 01:02
Contact:

Re: Sticky Shift

07 Mar 2017, 03:14

guest3456 wrote: Minor issues:
1. I still got the DOuble issue, but much much less frequently than my script. I pretty much have to press the letters simulatenously, which is hard to do
2. When CAPS is on, the Shift should then be a lowercase letter

1) :thumbdown: That is annoying. If my understanding of my own script is correct ( :lol: ), the only possibillity I can think of is that you hit the o when the script is doing,

Code: [Select all] [Download] GeSHi © Codebox Plus

SendInput, % {Shift down}{d down}{d up}{Shift up}

and, SendInput is reverting to SendEvent, then your input is not postponed until the send is done.
So I would change, in modifiedSend(),

Code: [Select all] [Download] GeSHi © Codebox Plus

SendInput, % prefix . "{" . A_ThisHotkey . " down}{" . A_ThisHotkey . " up}" . suffix

to

Code: [Select all] [Download] GeSHi © Codebox Plus

;SetKeyDelay,-1,-1 ; Try with and without this.
BlockInput,Send
SendInput, % prefix . "{" . A_ThisHotkey . " down}{" . A_ThisHotkey . " up}" . suffix
BlockInput,Default

This isn't a good solution either, since you would now loose the o output, but if my therory is correct, you would instead get Duble as often as you got DOuble. A better solution would be to have BlockInput,SendPostpone, you have to guess what I mean.

2) That makes sense.

Edit: Remember that you might need to run the script as administrator in order to enable BlockInput to work.
User avatar
jeeswg
Posts: 4283
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Sticky Shift

08 Mar 2017, 21:58

@Helgef Cheers.

For capitalisation I use:
- shift, letter - capitalise letter
- shift+capslock - capslock on/off
- win+space - capitalise last word (cycle: (random -->) lower --> title --> upper)
- ctrl+capslock - capitalise selection (cycle: (random -->) lower --> title --> upper)
- special hotstrings for capitalising i (with one exception: 'i.e.', and disabled on maths software e.g. Maxima CAS, TeXstudio)
- hotstrings for words e.g. 'ahk-' -> 'AutoHotkey', 'bush-' -> 'Bush', 'vtext' -> 'vText'
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

15 Nov 2017, 23:36

fixed a bug to allow Shift+aa=AA

ozzii
Posts: 303
Joined: 30 Oct 2013, 06:04

Re: Sticky Shift

16 Nov 2017, 03:15

jeeswg wrote:For capitalisation I use:
- shift, letter - capitalise letter
- shift+capslock - capslock on/off
- win+space - capitalise last word (cycle: (random -->) lower --> title --> upper)
- ctrl+capslock - capitalise selection (cycle: (random -->) lower --> title --> upper)
- special hotstrings for capitalising i (with one exception: 'i.e.', and disabled on maths software e.g. Maxima CAS, TeXstudio)
- hotstrings for words e.g. 'ahk-' -> 'AutoHotkey', 'bush-' -> 'Bush', 'vtext' -> 'vText'


How can I do to keep the selection active after 'ctrl+capslock'?
Because when you have to reselect the things for redoing the cycle it's not so convenient.
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

29 Mar 2018, 07:42

Helgef wrote:and tried to prevent the DOuble issue.


i'm still using my script with my laptop, but just for reference, i'm investigating moving to a programmable mechanical keyboard, and doing this at the firmware/hardware level:

https://docs.qmk.fm
https://docs.qmk.fm/feature_advanced_ke ... -shot-keys

User avatar
BGM
Posts: 406
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: Sticky Shift

29 Mar 2018, 11:02

I've used a compUSA SK-6200 ergonomic mechanical keyboard for decades. It was wearing out, so I actually found another one, unused and unopened, after all these years on ebay and bought it. I love it and never want to move to another keyboard, ever. I could test something if you like.
PCSsolutions
Posts: 1
Joined: 09 May 2018, 14:05

Re: Sticky Shift

14 May 2018, 01:17

Awesome script!!

You went above and beyond with the popup graphics. StickyShift will definitely help my pinky fingers from being sore toward the end of my work day.

What will help my pinkies even more is if I can totally not use them to Shift at all. Is it possible to trigger StickyShift with a tap of the ALT key while holding ALT+X should provide the normal ALT operations.

I just discover AHK and still learning its features and how to program more complex functionalities. If you can provide some suggestion on how to implement the ALT tap to Activate StickyShift, I much appreciated.

Thanks,
guest3456
Posts: 2302
Joined: 09 Oct 2013, 10:31

Re: Sticky Shift

14 May 2018, 09:22

PCSsolutions wrote:What will help my pinkies even more is if I can totally not use them to Shift at all. Is it possible to trigger StickyShift with a tap of the ALT key while holding ALT+X should provide the normal ALT operations.


I thought about this too. Using thumb for Alt keys to shift is another nice alternative. I think modifying these lines should do it:

Code: [Select all] [Download] GeSHi © Codebox Plus

Hotkey, LShift,    Shift_Down, on
Hotkey, RShift, Shift_Down, on
Hotkey, LShift Up, Shift_Up , on
Hotkey, RShift Up, Shift_Up , on

; ..... further down:

if (ErrorLevel == "EndKey:LShift") || (ErrorLevel == "EndKey:RShift")


change those to:

Code: [Select all] [Download] GeSHi © Codebox Plus

Hotkey, LAlt,    Shift_Down, on
Hotkey, RAlt, Shift_Down, on
Hotkey, LAlt Up, Shift_Up , on
Hotkey, RAlt Up, Shift_Up , on

; ..... further down:

if (ErrorLevel == "EndKey:LAlt") || (ErrorLevel == "EndKey:RAlt")


try it out and let me know if that works, and if it retains the normal Alt+X functionality when holding it down


Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir, kunkel321 and 10 guests