System hooks

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

System hooks

Post by richmond62 » Sun Dec 25, 2016 12:51 pm

I would like a stack to be able to detect when and what I am typing in a word-processing document while
the stack is in the background, when I mouseClick on the Skype icon, and so on and so on.

I.e. to detect keyPresses while not focused [all funny remarks about today being 25th December have been anticipated, so don't bother].

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: System hooks

Post by shaosean » Sun Dec 25, 2016 3:14 pm

You program might get flagged as spyware/virus because of that activity.. I also think that the security and sandboxing of the OSes might not allow for you to do that with all programs.. Not a real answer, but yes it should be doable, with those warnings in mind..

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10080
Joined: Fri Feb 19, 2010 10:17 am

Re: System hooks

Post by richmond62 » Sun Dec 25, 2016 4:03 pm

There are a whole series of programs that wives use to track
their husbands' porn addictions . . .

Now while I have no great urge to spend much time thinking about partners
spying on each other, nor on people's porn addictions, these bits of software,
presumably, employ system hooks to track what "naughty hubby" is typing
into his search engine while his wife is getting into the Codeine Linctus.

The morality and the legality (which, let us remember, do not always coincide) are not the things
under consideration here . . . this is, at least on the face of things, a series of interlinked forums
about HOW to get things done with LiveCode.

The ability to do this sort of thing, like use a knife, can be used for either good or bad:

1. Let's imagine a school for children who have various types of learning and/or physical disabilities;

a small, background standalone to track how successfully children with acute motor-control problems press
certain keys might help quite a lot in designing more effective keyboards for children with that sort of problem.

2. A teaching tool helping novices learn how to get around a WIMP GUI computer system: when the novice
launches the Word-processing application something that flags up "You have just started the word-processor"
could accelerate uptake.

3. Imagine a stack that could function as a "Super" Clipboard, allowing users to store that last 5,10,15,20, whatever,
items they have copied onto the clipboard:

the stack would have to detect every time the end-user clicked the COPY command and then collect the
clipboard data.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: System hooks

Post by shaosean » Sun Dec 25, 2016 7:57 pm

The end use is not my concern.. The ability to hook in to the system to monitor key presses borders on spyware/virus activity, never mind the activities of the end users.. You would be best to read up on Windows message hooks https://msdn.microsoft.com/en-us/librar ... s.85).aspx for more information on how to handle monitoring key presses (and pretty much anything else)..

For Mac OS X you'll probably want to look up NSEvent addGlobalMonitorForEventsMatchingMask

In regards to the clipboard idea, I don't think you would actually listen for the key commands, but you would monitor the actual clipboard/paste board being modified..

Post Reply