Menu

#7 Use custom autotype sequence with selected entry

2.0
open
nobody
None
2020-04-15
2020-04-14
Mark Bavis
No

I find I usually want my primary action to be password entry, and my secondary action to always open the entry, but sometimes I need to insert a random field from the entry that I've forgotten (such as {USERNAME}).

I forked the project at https://git.mhack.io/mark/AutoTypeSearch and created a second auto-fill text field on the SearchWindow where the user can enter a custom autotype sequence to use with the selected entry. It can be manually populated, or filled with a user-saved "favourite" entry. The favourites can be edited on the AutoTypeSearch options form, and are saved along with the other AutoTypeSearch options in the config file. A patch file is available at https://git.mhack.io/mark/AutoTypeSearch/raw/c3528f15092ac8a774ffc6855ed3622eb8716de8/AutoTypeSearch/custom_sequence.patch.

Discussion

  • AlexVallat

    AlexVallat - 2020-04-14

    Thanks for this. I wasn't able to get the patch to apply successfully, but I've just downloaded master branch from your GitBucket and applied that. I'm going to go through and review the changes in detail, then publish a new version with your new feature included.

     
  • Mark Bavis

    Mark Bavis - 2020-04-14

    Whoops, sorry about the patch. I think there was an extra commit in there that just had some changes to my vs project files due to verison differences. I meant to rebase it to the end of master so the patch wouldn't be based off of it, but I forgot. That's probably why the patch didn't work. There's still a few tweaks I was hoping to get in, that patch was more proof of concept. The autotype entry box on the main search window is a little janky with the autocomplete, I think it could use a couple of extra keyboard shortcuts. I just realized I think I also forgot to hook up the "Allow Custom Sequences" option, so the custom sequence box is always available... whoops! Let me know if you want me to make those changes and I'll let you know when they're done.

     
  • AlexVallat

    AlexVallat - 2020-04-14

    I've not finished the review yet, but one thing that stands out is that the WatermarkTextBox is... not great. I think from the comment in the source you didn't write it yourself, but it's rather leaky of GDI objects, and a bit slack with stuff like the pointless "join" parameter to JoinEvents. I was just going to drop it and use an ordinary text box, but if you want to find or write a better one, then let me know.

    I can tidy up the Allow Custom Sequences checkbox, no worries, but if the jankyness proves unacceptable and not easily resolvable I might hold this back until you have a resolution (or I have enough time to dedicate to investigating it myself)

     
  • Mark Bavis

    Mark Bavis - 2020-04-14

    Yeah that's fair. And yes, I definitely copied that code. I may try and rewrite one out of a windows form textbox and label after work today. The jankiness is just that it's hard to scroll through the autocomplete list in the auto-type sequence text box. It might just need keylisteners for Up, Down and Tab (you only really need Shift-Tab at that point to keep working since the only thing to do is to go back up to the search box). I'll take a look after work today.

     
  • AlexVallat

    AlexVallat - 2020-04-14

    The UI stuff in this is a little fiddly, I'm not sure this is the best approach. On balance, I am going to say I do not want an extra control in the search window, sorry.

    To try and achieve the same goals, how about this for a design? You still have a list of additional custom auto-type sequences, but these are all appended as additional sequences for the entry when it is auto-typed (perhaps as an optional action, so you could have Enter be normal auto-type and Shift-Enter be auto-type with extra sequences). This would then pop up the standard KeePass auto-type selection window to pick the one you want.

    I would also suggest simplifying the additional sequences editor rather than messing about with overlaying an edit control. This could even just be a multi-line textbox where you enter one sequence per line. For complex UI fiddling like this it needs to be tested and fixed under different screen DPI settings, and on Windows 7, 10 and Linux under mono too.

    If you really need to be able to type in a sequence, then I think this has to be a separate window to search. Again, an optional action you can choose that would pop open the window and let you type it in. I really don't think people are going to want to type sequences, though. Picking from a list, sure, but not typing. My workflow for autotyping random stuff is to have KPEnhancedEntryView installed, then use the Show Entry action. I can then just right click on the field I want and select AutoType <that field="">.</that>

    Thanks again for actually contributing code, though, I don't want to down-play what you've done, but I can't just accept it as is either, sorry.

     
  • Mark Bavis

    Mark Bavis - 2020-04-14

    Yup, that's fine. I didn't mean for it to go straight into production, but I wanted some feedback on how that functionality could work. I like the idea of having each auto type sequence be an extra entry for each search item (and I agree, you don't need dynamic text entry at this stage) although I'm worried that would create a huge list if you had a lot of matching entries. What if you could hit tab, and it would expand your currently selected entry into a list of entries with alternate auto-type sequences?

    I'll also give your KPEnhancedEntryView plugin a try, although I prefer a keyboard-only workflow whenever I get the chance, and it's a little awkward to try and navigate to the field I want. Anyways, thanks for the back and forth on how to accomplish this, I'll give some of these ideas a try!

     
  • AlexVallat

    AlexVallat - 2020-04-15

    I don't mean that the extra sequences would appear in the search window, I mean that the normal KeePass sequence selection window would be used. The same as you get now if you have multiple matching sequences on an entry:

    AutoType Entry Selection

    The flow would be, search for an entry, hit enter (or shift enter, whichever you have configured to be auto-type plus additional sequences), and this window appears allowing you to choose the sequence you want.

    An idea for a totally separate plugin would be to customise this window so you could directly enter a one-off sequence to type, but that's out of scope for AutoTypeSearch.

     

Log in to post a comment.