Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

New hotkey language


  • Please log in to reply
2 replies to this topic
rudnevr
  • Members
  • 3 posts
  • Last active: Oct 20 2015 03:10 AM
  • Joined: 26 Apr 2014

I'm a long time ahk fan, and my personal ahk script holds 5000 keymappings, including wrapper keymaps around nearly everything, from system things to Intellij Idea, Gvim, Firefox+Keyconfig and Firebug, ConEmu and anything using hotkeys.

 

The mappings themselves are pretty primitive, and rarely include more than 5 lines, for complex tasks I prefer other languages depending on the situation.

 

But due to lack of keys, many keymaps are difficult to manage. I normally create some additional context GUI windows and use #ifwinexist or WinExist() etc. for determining what key means in the current situation. It sort of tedious and might be automated.

 

I'm wondering what if we had a fully declarative css-like abstract syntax like this:

 

.winActiveClass #winExistsId windowName !controlName @systemVariable[userProfile=Work]  {

key: action;

}

 

* {!f4: closeWindow; !s: settings; } // works for all windows, including cmd

.textEditor {^y: deleteLine; } // deletes line in all defined textEditors

 

!browserCommandLine {

BackSpace: removeOneLevelInUrl;

!Backspace: removeAllExceptDomain;

!+Backspace: removeQuery;

}

 

so, from one side it would simplify managing the mappings and contexts, and also it could generalize the common actions: window management, tab management, forms input, text copy/edit, paging and navigation, search, settings.   Or specific cycles like write/compile/build/debug/log etc.

 

Ideally, I could imagine a cross-platform standard, compiling into specific OS).

 

Does it look promising?

What tools could be used for that?

What traps and obstacles could you see?

Did anyone try this before?

 

Thanks in advance!!



Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

I normally create some additional context GUI windows and use #ifwinexist or WinExist() etc. for determining what key means in the current situation.

 
I'm not really sure what you mean, but that sounds like the sort of workaround that has been superseded by #If (requires any AutoHotkey version greater than v1.0.48.05).
 
 
As for cross-platform, pretty much all of the important functionality would need to be rewritten from the ground up to work on other OSes (except where you can reuse bits and pieces of other projects). Some of the functionality or syntax might not even be applicable. You might be interested in this recent discussion: Replicating AutoHotKey's magic on a linux/unix/mac osx computer (thoughts on linux/osx port?)

rudnevr
  • Members
  • 3 posts
  • Last active: Oct 20 2015 03:10 AM
  • Joined: 26 Apr 2014

thanks for the answer, yes, looks like #if covers these cases, shamefully i didn't even know it exists. it is a great step to declarative way.

 

it is still verbose, though, so I'll be thinking about sacrificing some flexibility for manageability and readability. and also maybe expressing some important ahk practices as language-level concepts rather than dllcall() etc.

 

I realize that cross-platform means a lot of work and will look at it, thanks again for the link.