0

Here's the use case.

I use aText, a text expander. It has a hotkey to show a list of saved text expansions. I want to remove the need for manually pressing this hotkey. Therefore I need my OS to look at my keyboard and trigger this hotkey automatically when a specific sequence is found.

Ex.

  1. My hotkey to show the text expander list of expansions is CMD + SHIFT + S

  2. All of my expansion shortcuts starts with ;;

  3. When I write or press ;;, I want my OS to send CMD+SHIFT+S to the system, and thus triggering the expander list.

Is this possible somehow?

4
  • do you need that window open to be able to use the triggers, or is it just as a reminder of which key-sequence to use?
    – Tetsujin
    Feb 3, 2015 at 16:50
  • It's pretty much a reminder only.
    – jontelang
    Feb 4, 2015 at 2:06
  • ah, OK - then my idea wouldn't work. I was going to suggest moving them over to system prefs > keyboard > text instead.
    – Tetsujin
    Feb 4, 2015 at 8:23
  • 1
    I see, I need the extended capabilities a dedicated text expander though. I got one solution working, I posted it as an answer to the question if you want to have a look.
    – jontelang
    Feb 4, 2015 at 12:58

1 Answer 1

0

Okay, so after some tinkering I have a bit of a hack to make it work for me and it works a little bit like this.

1) I dowloaded an open source keylogger, and modified it to not log anything, just listen.

...  
char * currentKey = convertKeyCode(keyCode);  
char * target = ";";  
if( currentKey == previousKey && currentKey == target ){
...

2) When it sees that I pressed the two keys I choose it will invoke an apple script like this

...
system("echo \"tell application \\\"System Events\\\" to keystroke \\\"S\\\" using {command down, shift down}\" | osascript");
...

Which is the key I have in aText.

This works pretty well but I will wait for neater solutions before I set the question as answered.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .