Picking up non-in-card keydowns

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

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

Picking up non-in-card keydowns

Post by richmond62 » Fri Sep 13, 2019 7:01 pm

Sorry about that clunky title, but couldn't really work out how to express that otherwise. :D

So, I thought it would be a nifty thing to have a small standalone that
lurked in the top-right-hand corner of my right-most monitor
(I have 3 connected to my 2018 MacMini)
-
P_20190913_211909.jpg
-
that could let me know when I have
the TAB, SHIFT, ALT, CTRL/CMD on both my "main" keyboard and my auxiliary
half-keyboard (T9 Pro / Nostromo) down . . .
-
P_20190913_211903.jpg
-
Now, OBVIOUSLY, a stack containing a rawKeyDown command in a cardScript would
"do the magic", but IFF the cursor was focused inwith the stack.

However, I want my stack/standalone to pick up a rawKeyDown while the cursor/pointer is
in LibreOffice, Finder/Thunar (MacOS, XFCE respectively0 or whatever that is NOT the stack/standalone.

bogs
Posts: 3688
Joined: Sat Feb 25, 2017 10:45 pm

Re: Picking up non-in-card keydowns

Post by bogs » Fri Sep 13, 2019 8:08 pm

You know, I thought the same kind of thing would be possible just tracking the mouses location, as mentioned here, but apparently not so much. The only 'hackey' way I could think of was (for one monitor) to make a substack full screen and blended to 99 (invisible) and sink it below everything else. Problem is, it only works as long as no other application has focus :?

Craig had an interesting post in that thread, though, and his method did work, so you might modify it to report rawKeyDown events instead possibly...
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3442
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Picking up non-in-card keydowns

Post by richmond62 » Fri Sep 13, 2019 8:38 pm

It is quite possible I don't entirely understand how computers work, (OK, I don't)
but . . .

I do know that when a USB device (mouse, gamepad, keyboard, trackball, and so on) is activated
by a key being pressed, a button being pressed, a scroll wheel, etc. an electronic signal is sent
"down the wire" from the device to the computer, and, generally, the computer picks up that
signal.

Now there are computer programs that respond in pre-configured ways when a USB device sends
a signal to a computer whether that program has focus or not (think, for instance, of windowless programs
that work in the background while someone is doing other work - how about keyloggers for starters?).

Let's actually be unpleasant and imagine a nasty scenario: I begin to suspect that my cat is sending
offensive messages about me to friends of mine, but is calling herself "Gungadin" and using her
own e-mail account, while I am out of the house. So I want to build a keylogger with LiveCode
so I can catch my cat red-handed (err . . . red-pawed).

Now requirement #1 of my LC keylogger is that it should not be visible (i.e. the cat must not know
it is recording her keyboard activities) and must pickup key presses (and then dump them into a text file).
-
hackCat.jpg
hackCat.jpg (6.7 KiB) Viewed 80 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”