AutoHotkey Community

It is currently May 26th, 2012, 8:18 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 12  Next
Author Message
 Post subject: Extended extensions!
PostPosted: July 23rd, 2009, 12:16 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Farkas, are you active these days? :)

I've been using PKL since v0.2 and it's great. I'm still planning a few requests for it, but some will have to wait for now I think. However...

In the Windows keyboard manager, several things happen. First the physical scan codes are translated to 'virtual scan codes'; this is the basis for the so-called "registry method" of keyboard remapping. Then the layout .dll is used to map the virtual SC### into VK## virtual key codes and post characters etc to the input stream.

PKL currently takes on the latter two. Could it also do a scan code remapping first? That way, the 'comfort' layouts (shifting the QWERTY keys ZXCVB one key to the left) could be decoupled from the layout file itself: I'm now using two layout files for computers that have or haven't got the 'comfort' tweak in their scan codes! Also, it'd allow stuff like remapping a key to a Win key in a more robust way I think.

In fact, it'd be pretty much an 'extended' mapping - just without an 'extend' key but as a default mapping layer instead! Should the 'extend' mappings take it into consideration though? I think not - but the 'extend' mappings should probably have a specification of what you're mapping from so that people with non-standard scan codes could change only one setting instead of editing several extend mappings.

I really think the .ini file in a layout should be split up a bit. I think it'd be more sensible to use one file for the scan code remaps, then one for the fingerings (or that might be in the scan code file too) and finally one fairly untweaked .klc-based file. You shouldn't have to edit a file manually, ideally speaking, but put the extra edits in another file instead. Another such file could specify which keys you're giving a VIRTUALKEY mapping (for use with the 'extend' key or such) as well as the 'extend' layout in one separate file - this is mostly key based and not virtual key based (I used to call my own attempt the 'ScanSposer'!).

Ideally, this could let you use one scan code remap file (or several layered ones to get, e.g., first Colemak and then Comfort?!) to make your keyboard a Colemak/Dvorak/what-have-you mapped one, THEN the virtual mapping file would take care of the shift state and dead key mappings of your choice and THEN the 'extend' mapping file would make your keyboard even cooler. See my point?

I can foresee that this might create some trouble for the help images. It might be possible to make the images layered and use transparency! One base layer showing the physical keyboard, then a layer of colors for the fingering (if desired) and then key mappings on top. You would have to make one image for each combo of scan code mappings and virtual mappings, but the images could be done by a separate program or script like you do today. Sounds like work, unfortunately...

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Last edited by DreymaR on July 24th, 2009, 10:47 am, edited 5 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Extended extensions!
PostPosted: July 23rd, 2009, 12:54 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
The next step is asking for multiple extension modes!

I've been fiddling a lot with my 'extend' setup and I think it's fairly stable now. I'm really pleased with the awesome possibilities this opens up and it alone is a reason to be running PKL 24/7 and not only a normal Windows layout!

So, let me show you what I've got. First, mappings for the [layout] section of the layout .ini file (I think they should've been somewhere else, as mentioned!) to make it work:

Code:
; *** Using 'CapsLock' as 'extend_key' works best if it is mapped but otherwise disabled
CapsLock = OEM_CAPITAL   0   --   --   --   --   --   ; CapsLock
; *** To make a key work with the 'extend_key' modifier, it needs to be virtual-mapped as below.
; *** When VirtualKey-mapping the BACKSPACE/ENTER keys, use their enumerations BACK/RETURN.
; *** Remapping the TAB key is problematic: Alt-Tab becomes 'sticky', needing Esc to get out.
SC001 = ESCAPE   VirtualKey
SC00e = BACK   VirtualKey
;SC00f = TAB   VirtualKey
SC01c = RETURN   VirtualKey
SC039 = SPACE   VirtualKey
SC03b = F1   VirtualKey
SC03c = F2   VirtualKey
SC03d = F3   VirtualKey
SC03e = F4   VirtualKey
SC03f = F5   VirtualKey
SC040 = F6   VirtualKey
SC041 = F7   VirtualKey
SC042 = F8   VirtualKey
SC043 = F9   VirtualKey
SC044 = F10   VirtualKey
SC057 = F11   VirtualKey
SC058 = F12   VirtualKey


Now, for the [extend] mappings and more. You'll see that since I use Comfort layouts with and without registry remapping on different computers, I got into a bit of a pickle and had to use trickery; hopefully these things can be separated out in a later PKL edition so the problem becomes moot!

Code:
[extend]
; These keys are modified/transposed by holding down the 'extend key' (CapsLock by default):
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Esc + |F1 <> |F2 << |F3 >> |F4 <> |F5 <> |F6 << |F7 >> |F8 <> |F9 <> |F10<> |F11<> |F12<> |
;| Caps | Play | Prev | Next | Stop | Mute | Vol- | Vol+ | Media| BrHom| Mail | App1 | App2 |
;+======+======+======+======+======+======+======+======+======+======+======+======+======+
;|` ¤¤¤ |1     |2     |3     |4     |5     |6     |7     |8     |9     |0     |-     |=     |
;| Del  | F1   | F2   | F3   | F4   | F5   | F6   | F7   | F8   | F9   | F10  | F11  | F12  |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Tab   |Q ¤¤¤ |W *** |F <<> |P <>> |G *** |J ### |L ### |U ### |Y ### |; ¤¤¤ |[ ¤¤¤ |] ¤¤¤ |
;|      | Esc  | *WhUp| BrBck| BrFwd| *Btn1| PgUp | Home | Up   | End  | Del  | Esc  | Ins  |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Caps+ |A +++ |R *** |S +++ |T +++ |D *** |H ### |N ### |E ### |I ### |O ¤¤¤ |' ¤¤¤ |\ ><> |
;| ++++ | Alt  | *WhDn| Shift| Ctrl | *Up17| PgDn | Left | Down | Right| Back | Apps | BrFav|
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Z ¤¤¤ |X === |C === |V === |B *** |_ *** |K *** |M *** |, *** |. *** |/ *** |Spc ¤ |Entr¤ |
;| Undo | Cut  | Copy | Paste| *Le17| *Dn17| *Ri17| *Btn3| *WhLe| *WhRi| *Btn2| Enter| Break|
;+------+------+------+------+------+------+------+------+------+------+------+-------------+
;Legend: # Movement; + Modifiers; = GUI edit; * Mouse; <> MultiMedia; ¤ Various commands.


; NOTES:
; - This map shows a 'comfort' Colemak with VK_102 in the middle (the '_' key). See below.
;    * The actual remaps are by scan codes though, so the positions are layout independent!
; - Multiple extended mappings would've been nice; this setup is a general/basic one.
;    * For instance, accelerated nav/mousing, NumPad/maths, mirroring, coder's toolbox...
; - If your layout doesn't define the key, 'extend' won't work with it!
;    * Solution: Put, e.g., 'SC039 = SPACE   VirtualKey' etc in your layout .ini file.
;    * You'll need Escape/Space/Return/Back and F1-F12 for full functionality.
; - The Tab key is currently a poor candidate for remapping because of problems with AltTab.
;    * It might be useable as another extensor/modifier though? (Probably best left alone.)
; - My WARS = modifier block idea didn't work because R cannot map a modifier! A bug?!
;    * R can map non-modifiers, so I settled for another solution for now: The mouse wheel.
;    * My preferred way would have browsing/modifiers more ergonomically/logically placed:
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Tab   |Q ¤¤¤ |W <<> |F <>> |P *** |G *** |J ### |L ### |U ### |Y ### |; ¤¤¤ |[ ¤¤¤ |] ¤¤¤ |
;|      | Esc  | BrBck| BrFwd| *WhUp| *Btn1| PgUp | Home | Up   | End  | Del  | Esc  | Ins  |
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
;|Caps+ |A +++ |R +++ |S +++ |T *** |D *** |H ### |N ### |E ### |I ### |O ¤¤¤ |' ¤¤¤ |\ ><> |
;| ++++ | Alt  | Ctrl | Shift| *WhDn| *Up17| PgDn | Left | Down | Right| Back | Apps | BrFav|
;+------+------+------+------+------+------+------+------+------+------+------+------+------+
; - A Win key wouldn't be very useful here since nearly all Win hotkeys use letters/nums.
;    * It might be put in because of Win-F1/F3, Win-Break and the Start menu.
;    * Tip: T+Q (Ctrl-Esc) shows the Start menu too. Win-Help/Win-Search are on that menu.
; - Tech note: The mappings are on the form Send {%YourMappingHere%} (see the AHK Help).
;    * Thus, if you want, say, a modified keypress you can use, e.g., '}^{Left}{' or '}#r{'.
; - There isn't a sendable Undo key per se, oddly enough. (Ctrl+Z isn't a hard reach though.)
;    * However, A+O (Alt-Back) = Undo (http://www.geocities.com/ian_springer/winkey.html).
; - Mapping something to the Sleep key doesn't seem to do a lot on many computers.
; - The Pause and CtrlBreak are usually both on the same physical key, which is a bit weird.
;    * Using Pause, Win+Enter is System Properties.
;    * Actually, both Pause/Break and SysRq/PrntScrn send their codes strangely.
;    * Hence, I didn't remap any of them to avoid trouble.
; - The AppsKey and Btn2 may seem to do the same, but the menu appears in different places.
; - Mapping Del or Back (or something else?) to the ` key was a bit of a toss-up.
;    * For instance, use S+` (Shift-Del) to delete a file bypassing the Recycle Bin.
;    * The Back key is handy when navigating - but that's 2-handed work anyway.

; TIPS:
; - These mappings enable you to do many things without leaving the typing home position.
;    * Mappings are based on ease of reach vs. usefulness, and some left-hand-only use.
; - This could take some getting used to for the left pinky, but it gets really cool!!!
; - The Caps key plus Esc turns the CapsLock state on and off now.
; - It's handy to control your browser back/forward with the left hand only while browsing.
; - Similarly, the wheel up/down keys are favorites.
; - Space for Enter is also nice; can be worked with left-hand-only as well.
;    * To press dialogue buttons for instance, use Tab to move and Space/Q to select/abort.
;    * A+Space (=Alt+Enter) when a file/disk is selected, brings up the object's Properties.
; - Use the Apps (or *Btn2) for context menus; arrows, 'mousing' or shortcuts select items.
; - Esc mapped to '[' (Telnet/Vim/etc compliant) is okay, but a left-hand one is even better.
; - The left-hand Del key is also convenient; the right-hand one is best when editing.
; - Cut/Copy/Paste are Windows 'multimedia board' versions - should work mostly anywhere.
; - Using S/T (Shift/cTrl) with the UNEI/LY/O' keys you can jump words, jump/select, etc.
; - The number keys are mapped to function keys. They are reachable with the left hand!
;    * A4 closes apps; Win+3 GUI-searches; try 1(Help)/2(Rename)/3(Find)/5(Refresh) too.
; - The function keys are mapped to multimedia keys like the ones on multimedia keyboards.
;    * Browser_Stop/Refresh/Search are usually covered by hotkeys (e.g., Esc/F5/^F).
;    * Browser_Favorites usually needs a menu choice, so that's included (near the arrows).
; - The App1/2 keys are defined in the registry, in ShellExecute (REG_SZ) values:
;    * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\17
;    * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18
;    * Usually though, I find that the defaults of Explorer (App1) and Calc (App2) are fine.
; - Wheel Up/Dn are nice for scrolling window bars; Wheel Left/Right for horizontal scroll.
;    * Horizontal scrolling doesn't always work though, at least not before Windows Vista.
; - The 'virtual mousing' is rudimentary; a 'last resort' when arrows/Tab aren't enough.
;    * The 'mousing cross' is placed similarly to the 'mouse stick' on some boards.
;    * A mousing resolution of 17 pixels roughly fits *most* context and similiar menus.
;    * A full mouse layout could have multi-resolution, diagonals, Btn4/Btn5 and sticky Btn1.
;    * The keyboard's auto-repeat makes virtual mousing odd/'laggy' when a key is held down.
;    * In particular, beware of holding down the *Btn key(s) for a 'rapid-click' effect.


; *** 'ESC'/'SPACE'
SC001 = CapsLock
SC039 = Enter

; *** 'F1'-'F12': Multimedia keys, Logitech/Mac-style (F1-F4 are easiest to reach)
SC03b = Media_Play_Pause
SC03c = Media_Prev
SC03d = Media_Next
SC03e = Media_Stop
SC03f = Volume_Mute
SC040 = Volume_Down
SC041 = Volume_Up
SC042 = Launch_Media
SC043 = Browser_Home
SC044 = Launch_Mail
SC057 = Launch_App1
SC058 = Launch_App2

; *** Row 1 (numbers/symbols)
SC029 = Del
SC002 = F1
SC003 = F2
SC004 = F3
SC005 = F4
SC006 = F5
SC007 = F6
SC008 = F7
SC009 = F8
SC00a = F9
SC00b = F10
SC00c = F11
SC00d = F12
;SC00e = Sleep
SC00e = ScrollLock

; *** Row 2 (upper letter row)
SC00f = Tab
SC010 = Esc
SC011 = WheelUp
SC012 = Browser_Back
SC013 = Browser_Forward
SC014 = LButton
SC015 = PgUp
SC016 = Home
SC017 = Up
SC018 = End
SC019 = Del
SC01a = Esc
SC01b = Ins

; *** Row 3 (home row)
;SC03a = CapsLock
SC01e = Alt
SC01f = WheelDown
SC020 = Shift
SC021 = Ctrl
SC022 = Click Rel 0,-17,0
SC023 = PgDn
SC024 = Left
SC025 = Down
SC026 = Right
SC027 = BackSpace
SC028 = AppsKey
SC02b = Browser_Favorites
SC01c = CtrlBreak

; *** Row 4 (lower letter row)
;SC02a = LShift
; ***** SEE THE [EXTRA] SECTION FOR OPTIONAL 'COMFORT' REGISTRY REMAPPING *****
; Non-registry-mapped 'comfort' layout - VK_102 in the lower left corner is used as 'Z'.
SC056 = }!{Backspace}{
SC02c = Cut
SC02d = Copy
SC02e = Paste
SC02f = Click Rel -17,0,0
SC030 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton
; ***** END OF 'COMFORT'/'NON-COMFORT' PART (PASTE BETWEEN THESE LINES) *******
SC033 = WheelLeft
SC034 = WheelRight
SC035 = RButton
;SC036 = RShift


[extra]
; This section is not read by the program, but contains snippets for other sections.

; Mappings for scan code mapped versus unmapped 'comfort' layout (ZXCVB+VK_102 keys)
; (These keys may already be mapped on a lower level than PKL, by registry)
; Copy the appropriate set into your pkl.ini -> [extend] section, row 4.

; Non-registry-mapped 'comfort' layout - VK_102 in the lower left corner is used as 'Z'.
SC056 = }!{Backspace}{
SC02c = Cut
SC02d = Copy
SC02e = Paste
SC02f = Click Rel -17,0,0
SC030 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton

; Non-registry-mapped 'non-comfort' layout - if you have no VK_102 key (or WANT pain?!).
SC02c = }!{Backspace}{
SC02d = Cut
SC02e = Copy
SC02f = Paste
SC030 = Click Rel 0,17,0
SC031 = Click Rel -17,0,0
SC032 = Click Rel 17,0,0
; Instead of a mouse 'cross', there's now up/down and left/right pairs.
; If you need the middle button, you may replace, e.g., the left-hand Esc (but I wouldn't).

; Scancode/registry mapped 'comfort' layout - VK_102 now sits in the old 'B' position.
SC02c = }!{Backspace}{
SC02d = Cut
SC02e = Copy
SC02f = Paste
SC030 = Click Rel -17,0,0
SC056 = Click Rel 0,17,0
SC031 = Click Rel 17,0,0
SC032 = MButton


I'm totally loving this - did I mention that? ;) As you can see, this contains a bit of 'everything' and is a General/Default extended mapping. It has navigation/editing (even a dirty mousing solution for when you need to move the cursor just a little and don't want to grab the mouse!), multimedia and other fancy keys without buying new hardware, ergonomic ways of hitting F keys and Enter/Esc/etc (I use these a lot, such as A+4 for Quit Program or Spc/Q with Tab (unmapped) to move around in dialogs) and pretty much the kitchen sink too.

Now I'd like a mapping that gives me the NumPad. And an accelrated navigation/mousing mapping to get around faster (for instance, the UNEI should go 5 or 10 steps per key press), mirrored keyboard mappings for one-handed typing, a hotstring mapping... :twisted:

For this, even using multiple 'extend' keys wouldn't be enough as don't think doubling up commonly used keys as extended modifiers is a good idea. Yes, I think the program should allow more than one extended modifier but also another solution! I think this might be solved by implementing multi-clicking extenders. Let's say I hit CapsLock for my usual mappings, but if I tap-and-hold (like a double click) instead I'd get an alternate layout with F13-24, accelerated arrows/mousing etc. If I tap-tap-hold maybe the NumPad++ layout? More than that would be a bit insane I think, but it'd make one extender into three! The example of the NumPad is a good one I hope, since I'll usually keep using numeric entry for a while once I've started; hence, triple-clicking a modifier to activate it wouldn't be so harsh.

I'm thinking that a handicapped person could get a foot pedal, set it up to produce, say, a F20 scan code and use that as a modifier for mirrored typing to use his or her only working hand! And if the hand isn't very movable, how nice to have the other extensions too so that you have to move less.

Maybe it'd be nice to invent a clear way to specify several remaps? For my ScanSposer program I thought up something like this, but didn't finish it (in part because I started just using PKL instead!):

Code:
; New style mapping template - Colemak (Comfort) annotated
[Mapname]
;  +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
;  |`    |1    |2    |3    |4    |5    |6    |7    |8    |9    |0    |-    |=    |
R1="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
;  +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
;  |Tab  |Q    |W    |F    |P    |G    |J    |L    |U    |Y    |;    |[    |]    |
R2="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
;  +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
;  |Caps |A    |R    |S    |T    |D    |H    |N    |E    |I    |O    |'    |\    |
R3="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
;  +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
;  |Z    |X    |C    |V    |B    |102  |K    |M    |,    |.    |/    |Spc  |Enter|
R4="sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|sc0¢¢|"
;  +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
ExtMod="SC###"
ModRel=""

The idea is to make it almost like the help figure I made in the pkl.ini file. The blank fields in the R# rows could be filled with either SC### values, key names, ASC codes or anything else the Send command will allow if the setup is flexible enough. SC### are the most compact but they're also less intuitive. Reading the '|'-delimited lines should ignore leading/trailing white space so the entries can be aligned in the file; my mousing mappings were the longest and they took 17-18 characters but 'Browser_Favorites' is long too.

- I first tried ARS (Colemak) for the modifiers Alt-CtRl-Shift as that would be ergonomic and easy to remember, but the R key can't be mapped to a modifier successfully for some really odd reason! Any thoughts on that; could it be a subtle bug in PKL somewhere?

- The mousing pad is nice for quick-and-dirty use, but one thing that bothers it is key repeat. I'd like it to repeat, but then when I release the key the buffer should've been cleared but instead there's a lot of further movement stored up so the cursor keeps sailing past where it should be. Not sure whether anything could be easily done about that. Maybe the release of the 'extend' key could trigger a buffer flush?

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Last edited by DreymaR on July 27th, 2009, 4:02 pm, edited 11 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2009, 1:30 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Here's an idea of an 'even-more-ultimate' PKL: Like in the commercial layout program Keyman by Tavultesoft (that you know!), allow the ScrollLock key to become a Kana modifier, and use the additional shift states!

Depending on the states of the Caps light and the Scroll light, there would be four major states - each with a Shift state of course: I'm thinking that these should be used for major scripts. Base for the latin, and then Greek, Kyrillic and Hebraic glyphs in a one-fits-nearly-all layout. It probably wouldn't be the solution of choice for someone who writes Greek all day, but if they were switching back and forth a lot it'd be awesome. Example: A person studying the Bible would conceivably need to use latin, greek and hebraic scripts at different times. Or someone using one of these scripts for a language study (they'd also want a phonetic solution - I'll get back on that!).

A MSKLC .klc file doesn't in theory support the Kana states, and MSKLC certainly won't let you fill them in. But that wouldn't be necessary; the files could be made from more than one .klc file or just edited manually. I think the extra Kana states should be kept in a separate file, too.

One way of doing extra states I've thought up, would be to create an invisible window called, say, 'PKL_Caps' or 'PKL_CapsScrl' etc depending on the Caps and Scroll lock states. The hotkeys could then be made as #IfWinExist hotkeys. But it's probably easier and quicker to check for the states on the fly with, e.g., 'GetKeyState("Capslock", "T")'.

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Last edited by DreymaR on August 13th, 2009, 11:56 am, edited 6 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2009, 1:45 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Another question or two:

What about making it possible to start up PKL suspended? Or at least with no layout loaded? So it could be run on startup on my wife's computer and then when I needed it I could hit the shortcut key to get it activated.

Might a few command-line switches be good? So that it could be run by different shortcuts to start it with different layouts, suspended etc.?

Could the tray tip for PKL show something nicer than just 'pkl.exe'? Here's what I'd do:
Code:
Menu, Tray, Tip,
(
PKL v0.# - FMáté 2009. Active layout:
%YourLayoutNameVariable%
)


Do you still spend time looking for which modifier states are active? If so, wouldn't just a Send {Blind} take care of business faster?

Is that all, I wonder? Not included the thoughts on running the actual compiled MSKLC .dll instead of making an .ini file from it, of course... Oh dear, I've exploded all over this thread now! :shock:

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2009, 6:02 pm 
Offline

Joined: October 28th, 2007, 10:41 am
Posts: 75
Location: Hungary, Érd
CapsLock led

DreymaR wrote:
fmate14 wrote:
aoeui wrote:
1. When the Caps Lock is on, the Caps Lock LED keeps blinking when typing. Of course, it's not a big problem. But I think it will be better if the LED doesn't blink.

I think too. But it is because of AutoHotkey, I can't do anything.

This isn't strictly true. If you were to make a special intercept for state lock keys (Caps/Num/Scrl) you'd have manual control over their lights if desired. See the 'Set####LockState' commands for how to make the lights 'always on/off'. But I'm sure if it's worth making the rest of the program go (a bit) slower to get that thing in order.

Sorry, but I don't understand. If I try:
Code:
setCapsLockState, On
a::Send, B
or even
Code:
setCapsLockState, AlwaysOn
a::Send, B

(without using any AHK scripts) the CapsLock led still blinks.


Multiple Keyboard Hooks

DreymaR wrote:
I also have a thought about the problem with PKL and other AHK scripts: It's not about running multiple scripts, but about multiple keyboard hooks I think. If a hook high up in the priority queue catches a key message and processes it, the same message isn't necessarily passed on to the rest of the queue afterwards. That's why the hook keys don't trigger themselves, I think?

I don't understand very well, but… As I have seen, the universal hooks has less priority, and PKL use these. For example if m.ahk contains:
Code:
a::Send, B
, this will work even m.ahk is runned after or before pkl.ahk. Sorry my english. I maybe don't understand your problem here.


Variable names

DreymaR wrote:
Not entirely sure how to solve that conundrum, but if all the variable names in PKL are given unique names (I always like to start my variables with initials of the script, like 'pklVarname' for instance)...

Currently, PKL uses only six global variables, but I try use less or use a prefix. Using unique function names is more difficult, PKL has became a relatively big program and currently works well (even with Windows 7), even I knows, it contains anti-patterns or something else bad programming technique.


Others

DreymaR wrote:
What about making it possible to start up PKL suspended? Or at least with no layout loaded?
I have added a “startsInSuspendMode” pkl.ini option.


DreymaR wrote:
Might a few command-line switches be good? So that it could be run by different shortcuts to start it with different layouts, suspended etc.?
Currently there is only one command-line parameter: you can set the layout. (PKL uses it too when you switch between two layouts.)


DreymaR wrote:
Could the tray tip for PKL show something nicer than just 'pkl.exe'?
Thank you!


DreymaR wrote:
[…]running the actual compiled MSKLC .dll instead of making an .ini file from it, of course
There is two problem with this. (1) I can not work with binary .dll files. Even with .klc files. (I use Perl to convert .klc to .ini) (2) The .ini files can contain some information which the .dll (or the .klc) files cannot.


And…

To be continued…

_________________
Portable Keyboard Layout
Happy Sunday


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2009, 5:00 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Thanks for your answers and efforts so far! Could you please send me new versions of your code when you feel they are ready? And at any rate you should compile a new PKL in AHK 1.0.48.# because I hear it can run faster - it'd also show SourceForge that you're still here. :)

- The problem with the multiple hooks is what you and other have described earlier: PKL doesn't always work with other AHK scripts that use hotkeys. I was just trying to explain my theory that it depends on hook priority, and that hooks at the same 'level' can get priority over each other according to which program started up last. I think. :)

- I don't remember the story of the CapsLock key; it wasn't my own problem. I use an unmapped CapsLock myself, so it'll make a good 'extend' key instead! Then, I map 'extend' plus Esc to CapsLock to turn the light/state on and off. Never mind.

- Today, I tried playing with more extensions! I added more keys to [layout]:
Code:
SC152 = INSERT   VirtualKey
SC153 = DELETE   VirtualKey
SC147 = HOME   VirtualKey
SC14f = END   VirtualKey
SC149 = PRIOR   VirtualKey
SC151 = NEXT   VirtualKey
SC14b = LEFT   VirtualKey
SC148 = UP   VirtualKey
SC150 = DOWN   VirtualKey
SC14d = RIGHT   VirtualKey


Then, in pkl.ini [extend]:
Code:
; *** SPACE/ /INS/DEL/HOME/END/PGUP/PGDN/ /LEFT/UP/DN/RIGHT
SC039 = Enter

;SC152 = Ins
;SC153 = Del
SC153 = Sleep
;SC147 = Home
;SC14f = End
SC149 = PgUp 3
SC151 = PgDn 3

SC14b = Left 6
SC148 = Up 6
SC150 = Down 6
SC14d = Right 6


Presto - accelerated extended PgUp/Dn and arrows! They worked well I think.

Using the Ins key for 'SC152 = }!d{}http://www.{' was fun too: In Internet Explorer, it opens the address bar and starts typing an address. Hotstrings can be nice, especially when they may contain other keys too.

Unfortunately, VK-mapped arrow keys didn't work well with the (physical) Shift key?! Seems to work a while, but then it takes BOTH Shift keys to select text with the physical arrow keys? Tapping RSh while holding LSh works, but not tapping LSh while holding RSh?! The VK-mapped arrows had no problem with the Ctrl keys; they still jumped words just fine with them. I've also had the Shift state hang on me using this. Similar thing happened with the remapped Del key and the physical Ctrl key.

PKL may be sending some strange shift state stuff that confuses Windows?

- The more I think about a multi-state Extend key the better it sounds. One state (tap then hold?) would give accelerated navigation/mousing, and the next (two taps?) would give access to the NumPad and hotstrings etc layout.

I think a tap-hold solution could be done by setting a variable to the system time on 'tap key' Down, then if the system time is just a little more (<250 ms?) on 'tap key' Up a 'TapCount' variable is incremented. If the next Down or Up press is a long time (>500 ms?) after the previous Up/Down, the 'TapCount' is reset. The Extend routine then simply uses the 'TapCount' to determine which mappings to use!

On consideration, I wouldn't use the Extend key to tap with, because then the Extend key would become 'laggy' and less responsive to un-tapped presses. Better then to tap another key before the CapsLock! Since I think that remapping Tab might cause trouble and you can't tap keys that produce effects alone, the most likely candidates would be one of the Shift or Ctrl keys. I think it would be too stressful for the left pinky if it had to dance between the left Shift and CapsLock a lot. The left Ctrl might look promising then since that can be tapped with the side of the hand instead of a finger if you want to. But I tried doing that on boards with wrist rests and on flat laptop-type boards and that was no fun. So maybe the best answer is to use the right-hand Shift key for the 'tap key'.

[Edit: I've thought it through some more and I think the best thing to do would be to use the modifiers instead! Then there'd be one Extend mapping for unshifted CapsLock, and up to three others for Shift and/or Ctrl then CapsLock. This would be easy enough to do, and the most powerful and flexible solution for sure. The only consideration would be disambiguation: Since you'd sometimes want Extend(1)-Ctrl-something and at other times Extend(3)-something (or even Extend(3)-Ctrl-something!) the keypress timing becomes important. I'd think that you'd want to check on each press of the Extend key whether the modifier key(s) are held down within a short time like <100 ms (equals 120 WPM typing speed). If you'd want a higher-level Extend mode and a Ctrl-press you'd then have to press Ctrl with the Extend key and then release and repress it while holding down the Extend key. Shouldn't be too hard.

Separating between right-hand and left-hand modifiers would allow for even more states like LCtrl+RCtrl or LShift+RCtrl etc, but that'd likely be complete overkill. I'd rather have the flexibility of selecting state with either hand, I think. Since the Alt key is often different on the right and left side and has many other uses, I wouldn't use that either.]

Maybe I'll try out a code snippet to do this. Sounds like good fun.

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Last edited by DreymaR on August 13th, 2009, 11:58 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Overriding PKL hotkeys
PostPosted: August 8th, 2009, 5:07 pm 
I have a question about Portable Keyboard Layout. I'm currently using it to load the Colemak keyboard layout, but whenever I have PKL loaded, I find that I am unable to override some hotkeys from other scripts. I want to use bug.n to tile my windows, but when I tried to make Win+e do a certain function, it loads Explorer instead. I wrote my own script which should bring up a message box for Win+e, and, no matter what order I load the scripts in, whenever I have PKL loaded, Win+E loads explorer. When I close PKL, then Win+e loads my message box.

Is there something I can change in the PKL source so that it does not override certain hotkeys from other scripts?


Report this post
Top
  
Reply with quote  
PostPosted: August 8th, 2009, 5:57 pm 
Offline

Joined: October 28th, 2007, 10:41 am
Posts: 75
Location: Hungary, Érd
jrick wrote:
[...]but whenever I have PKL loaded, I find that I am unable to override some hotkeys from other scripts [...] When I close PKL, then Win+e loads my message box.

Can you post your file? Because if I create an AHK file:
Code:
#e::MsgBox, It works well
it works well for me with PKL. (in Vista and Win 7)

_________________
Portable Keyboard Layout
Happy Sunday


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 8th, 2009, 10:54 pm 
fmate14 wrote:
Can you post your file? Because if I create an AHK file:
Code:
#e::MsgBox, It works well
it works well for me with PKL. (in Vista and Win 7)


I'm running PKL on Vista.

Code:
#e::
MsgBox It works
return


I've done some more testing, and it seems to (sometimes) work when I use Win+f (QWERTY e), however, when I try to set it to k (Colemak e), then Win+e (Colemak) loads up Explorer to Computer, instead of showing the message box.

Which layout are you using with PKL? Colemak? And which version?


Report this post
Top
  
Reply with quote  
PostPosted: August 9th, 2009, 9:45 pm 
Offline

Joined: October 28th, 2007, 10:41 am
Posts: 75
Location: Hungary, Érd
jrick wrote:
I've done some more testing, and it seems to (sometimes) work when I use Win+f (QWERTY e), however, when I try to set it to k (Colemak e), then Win+e (Colemak) loads up Explorer to Computer, instead of showing the message box.


Okay, I have an idea: the order of the programs could be:
  1. PKL, then your script → You must use the new button (Win+f)
  2. Your script, then PKL → You must use the original button (Win+e)


But you can not set the order! So you must use both the original and the new button – or use scan codes (SCxxx).

This is only an idea, because it works well for me. (I use PKL to improve my own native layout at home, so I don't remap the layout, just extend.)

Sorry my english.

_________________
Portable Keyboard Layout
Happy Sunday


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Generating images
PostPosted: August 21st, 2009, 9:09 pm 
Hi!

Your program is really useful; I've been telling my friends about it. Thank you very much!!!

Following your instructions, I was able to create my own custom Dvorak layout and it works perfectly. However, I don't understand how to generate the images.

Your instructions were:

Quote:
* Copy the .klc (generated from MS Keyboard Layout Creator) to the utilities directory
* run klc2ini.pl (requires Perl)
* review out/layout.ini


Which worked perfectly - the layout generated works. However:
Quote:
* run ini2html


didn't produce anything at all (the Portable Keyboard Layout\utilities\ini2html folder only had an empty template.html). What am I doing wrong?

Thanks for any help


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2009, 10:03 am 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Not sure whether the template file needs to contain anything.

You'll have to have the layout.ini file in the same folder as ini2html.pl as far as I can see. It should then generate a layout.html with the images of the layouts (as html buttons) that you can then capture.

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2009, 2:26 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Browsing the PKL source code a little, it seems that you're doing far too much!

In pkl_keypress, there are a bunch of else's for each single keypress. Example:

Code:
   } else {
      if ( ch == "Cut" ) {
         ch = +{Del}
      } else if ( ch == "Copy" ) {
         ch = ^{Ins}
      } else if ( ch == "Paste" ) {
         ch = +{Ins}
      } else {
         ch = {Blind}{%ch%}
      }
      Send %ch%


This really ought to be replaced with a simple 'Send {Blind}{%ch%}' and then let the pkl.ini (or rather, an extend.ini) file contain entries like '}+{Del}{' for the 'Cut' etc! Then, execution would be faster overall and hardly slower for the Cut/Copy/Paste keys either!

I also believe that you could read the modifier states in one statement and use bit logic to sort them out, instead of the lengthy code blocks you use now.

I think there may be several overdone places like that around.

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2009, 4:53 pm 
Offline

Joined: October 28th, 2007, 10:41 am
Posts: 75
Location: Hungary, Érd
Dear DreymaR!

Someones said, the root of every wrong thing is too early optimization. (Sorry my english).

So I have tested your request. In pkl_keypress:
Code:
startTime = 0

keyPressed( HK )
{
   global startTime
   startTime := A_TickCount
[…]
}

extendKeyPressed( HK )
{
   time1 := A_tickCount
   global startTime
[…]
   time2 := A_TickCount
   Send %ch%
   
   t1 := time1 - startTime
   t2 := time2 - startTime
   t3 := A_TickCount - startTime
   MsgBox, %t1% ** %t2% ** %t3%
}

The result is (on my computer with Win7): 0 ** 0 ** 16.
What does it mean? The whole run of the scipt from the entry point of the “keypressed” function to entry point of the “extendKeyPressed” function requires 0 millisecond, and the commands in “extendKeyPressed” function before sending a character require 0 millisecond. The
Code:
Send %ch%
line requires 16 (sometimes 15) milliseconds.

So I think, using
Code:
SC02d = }+{Del}{
instead of
Code:
SC02d = Cut
in the pkl.ini, it is more complicant, harder to understand, but not really faster.

_________________
Portable Keyboard Layout
Happy Sunday


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 1:27 pm 
Offline

Joined: May 24th, 2009, 1:23 pm
Posts: 89
Location: Bærum, Norway
Are you sure you did that test right? I mean, 0 ms is a very short time for such a long routine. If you for instance put, say, three 'Send %ch%' somewhere into the code of each of the two functions, will they then be ~45 ms longer than 0 (so they'll be around 45 ms) in your test?

You mean 'complicated' not 'complicant', right? Not 'compliant' or anything else?

_________________
Better burden you cannot carry than man-wisdom much -- Hávamál


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 170 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 12  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], notsoobvious, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group