Jump to content


Photo

Programmatic access to key history?


  • Please log in to reply
6 replies to this topic

#1 himanshu

himanshu
  • Members
  • 95 posts

Posted 24 June 2012 - 05:10 PM

It seems there is no way to programmatically access the key history (apart from the last key).

At a couple of occasions, I've found myself needing to know the last 2-3 keys, and have had to come up with complicated workarounds to achieve what I wanted (and such workarounds aren't even going to be possible every time).

Can AHK_L provide such a feature in some future release?

#2 Pulover

Pulover
  • Members
  • 1242 posts

Posted 24 June 2012 - 05:25 PM

This is being asked for a long time <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=7081">viewtopic.php?t=7081</a><!-- l -->
And I would too like to see this feature.

#3 Guests

  • Guests

Posted 11 October 2012 - 03:15 AM

// Logging keys to a file is disabled in the main version in an effort to prevent
// AutoHotkey from being branded as a key logger or trojan by various security firms and
// security software. Uncomment this line to re-enabled logging of keys to a file:
//#define ENABLE_KEY_HISTORY_FILE

Logging keys to a file via keyhistory command is the same as "direct access" to key history.
So Posted Image

#4 Pulover

Pulover
  • Members
  • 1242 posts

Posted 11 October 2012 - 10:31 AM

Interesting. But KeyHistory can currently store up to 500 events so it doesn't have to log them to a file, we only need it stored in an array. I don't think this could flag AHK itself as a keylogger by any means.

#5 himanshu

himanshu
  • Members
  • 95 posts

Posted 11 October 2012 - 11:20 AM

I agree. Key History already allows one to "see manually" the history of last 500 keys pressed. All we're saying would make a nice feature is programmatic access to the same information.

In any case, making a key-logger shouldn't be hard without this feature:
1) Make ~ (go through) hotkeys for all keys.
2) Log to a file on each hotkey invocation.

#6 geekdude

geekdude
  • Members
  • 323 posts

Posted 25 October 2012 - 02:24 AM

making a key-logger shouldn't be hard without this feature


I always had the issue that while one key was messing with the file, the other keys were missed, and I only got around 2/3 of the keys while I was typing quickly.

#7 Pulover

Pulover
  • Members
  • 1242 posts

Posted 25 October 2012 - 10:26 AM

There are other ways to capture key presses.
This pages has an example with OnMessage by just me: <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?f=1&t=75242&start=15">viewtopic.php?f=1&t=75242&start=15</a><!-- l -->
And this one has one using WindowsHook <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?p=299816#p299816">viewtopic.php?p=299816#p299816</a><!-- l -->

Missing keys is usually solved with SetBatchLines -1, but I suppose you have that already.