Page 1 of 1
Distinct capitals for macros (or testing Shift key)
Posted: Sat 06 Feb, 2016 12:11
by galaxy_far_FAR_away
I want to use Fast Find function (which is mapped to Alt+Key by default) by pressing Shift+Key. I tried "Macro { key="A"; ..." but that is activated by small 'a' too.
1a.) So, I like to know how can I test Shift key status?
1b.) ...or how to use a Unicode function to test if a character is capital?
2.) Why LUA not distinguish hotkey capitals?
3.) Is there a more elegant way to bring up 'Fast find' dialog?
This ugly code not works for international characters:
Code: Select all
local function my_key ()
if (akey(0) < 96) -- capital (works only for ASCII)
then
Keys "Alt? BS" -- brings up 'Fast find'
end
Keys "Akey"
end
Thanks for Your answers!
Distinct capitals for macros (or testing Shift key)
Posted: Sat 06 Feb, 2016 12:36
by Shmuel
galaxy_far_FAR_away wrote: 1a.) So, I like to know how can I test Shift key status?
If I remember correctly there is currently no way to detect that from a macro (though one can use PeekConsoleInput via FFI to do that).
galaxy_far_FAR_away wrote: ...or how to use a Unicode function to test if a character is capital?
Use either
far.LIsUpper(c)
or
c:match("%u")
.
galaxy_far_FAR_away wrote: 2.) Why LUA not distinguish hotkey capitals?
That is the way it always has been.
galaxy_far_FAR_away wrote: 3.) Is there a more elegant way to bring up 'Fast find' dialog?
I don't know. I use Fast Find Enhanced plugin.
Distinct capitals for macros (or testing Shift key)
Posted: Sat 06 Feb, 2016 15:15
by HaRT
galaxy_far_FAR_away, though not exactly what you ask for, I've just successfully assigned opening the QSearch box to a single Shift
key (pressed and released). Is it elegant enough?
Distinct capitals for macros (or testing Shift key)
Posted: Sat 06 Feb, 2016 23:52
by galaxy_far_FAR_away
Both capital tests works, I have chosen the "match" variant (it is terrible why I not learn LUA entirely
I should do...)
Under "Elegant way to bring up Fast Find" I meant a function call to open that input field.
Now I faced another problem: it is a way to do "Macro { key="Alpha"; ..." ? I'm fear there is no way... Now I must to assign all ASCII & beyond-ASCII (national) keys to "my_key ()" separately. Instead an "Alpha" option would be nice
Thanks for Your support!
Distinct capitals for macros (or testing Shift key)
Posted: Sun 07 Feb, 2016 00:21
by Shmuel
galaxy_far_FAR_away wrote: Now I faced another problem: it is a way to do "Macro { key="Alpha"; ..." ? I'm fear there is no way...
key="/\\i/";
or
key="/[\\i\\d]/";
depending on what you want.