Custom keyboard

Interested in using the many environmental add-ons and extensions from LiveCode and third parties to the flexible LiveCode environment? This is the place to talk about it.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

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

Re: Custom keyboard

Post by bogs » Fri Nov 08, 2019 10:12 pm

Ours tried to eat the mouse attached to the laptop. Of course, Rumbles has an excuse. He is brainless.
ksnip_Rumbles.png
So fat, I think he may HAVE eaten that mouse!
ksnip_Rumbles.png (96.65 KiB) Viewed 15595 times
Image

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Custom keyboard

Post by Thierry » Fri Nov 08, 2019 10:19 pm

The cat obviously admires a photo of a desktop machine with an attached mouse.
unnamed.jpg
:)

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

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

Re: Custom keyboard

Post by bogs » Sat Nov 09, 2019 2:32 am

Oh, I *know* Rumbles knows the difference, once he left a dead mouse on the bed, just to show me what he is capable of. Then he promptly went back to sleep, which is his natural state, aside from eating :P
Image

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

Re: Custom keyboard

Post by richmond62 » Mon Nov 11, 2019 12:20 pm

"ksnip" Hmm . . .

Ok, "darling"
-
ksnip-editMeExternally.png
-
When I crank up my PPC G5 iMac running 10.4.11 the Metacard Prefs do NOT feature the "ScriptEditor" tab,
probably because I am not using the 3.5 IDE.

Seem quite unable to get either of Jacque's Magic stacks to "do" the magic with LC 4.0 and a folder containing Metacard 2.4.

This is a pox as still trying to track down a way to off-load key presses to some external something.

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Custom keyboard

Post by trags3 » Mon Nov 11, 2019 2:15 pm

WOW!!! Look what I started!
I had an opportunity to design a custom keyboard where the (Potential) client suggested he could save more than an hour/day.
Without knowing how he intended to save that much time with a simple keyboard layout I assumed that he might want to have keys associated with whole sentences or even paragraphs.
I figured out that probably the best solution for this would be to have an LC App that accomplished this and then do a copy and paste into the WhatsApp app.
Thanks for the entertainment and the help!
Tom

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Custom keyboard

Post by jacque » Mon Nov 11, 2019 5:48 pm

This is a pox as still trying to track down a way to off-load key presses to some external something.
I doubt that's possible. Allowing one app to type into another would present security issues.

Apps are written to accept input only from the OS. Someone with the right skills might be able to hack in and change that but I'd be surprised if a high level language like LC could do it. It would also probably be considered malware.

Windows and Mac have interapp communication that allow you to send specific messages to any other app that is written to accept them. But without their cooperation they won't respond to outside input.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Custom keyboard

Post by FourthWorld » Mon Nov 11, 2019 6:01 pm

jacque wrote:
Mon Nov 11, 2019 5:48 pm
This is a pox as still trying to track down a way to off-load key presses to some external something.
I doubt that's possible. Allowing one app to type into another would present security issues.
It is possible to emulate a keyboard, and it is a security issue. See Rubber Ducky as one example:

https://latesthackingnews.com/2017/06/16/20456/
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Custom keyboard

Post by FourthWorld » Mon Nov 11, 2019 6:11 pm

trags3 wrote:
Mon Nov 11, 2019 2:15 pm
I figured out that probably the best solution for this would be to have an LC App that accomplished this and then do a copy and paste into the WhatsApp app.
That seems a very good approach, simple and cost-effective.

If a more elaborate solution may be needed down the road, another option may be to fully compose and send messages to WhatsApp from your LC app using the WhatsApp API:

https://developers.facebook.com/docs/wh ... ng-started
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Custom keyboard

Post by trags3 » Mon Nov 11, 2019 8:59 pm

Thanks, Richard and Jacque.
I tried the copy and paste thing. It seems to work. Copy to the clipboard and then paste into the message box of the WhatsApp App. That works on my iPhone. Maybe a security hole in WhatsApp but.....

Tom

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Custom keyboard

Post by trags3 » Mon Nov 11, 2019 9:47 pm

By the way, Android allows 2 Apps to be displayed at the same time using a split screen. This makes it even easier to do the copy/paste task on Android.

Tom

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Custom keyboard

Post by FourthWorld » Mon Nov 11, 2019 10:24 pm

trags3 wrote:
Mon Nov 11, 2019 8:59 pm
Thanks, Richard and Jacque.
I tried the copy and paste thing. It seems to work. Copy to the clipboard and then paste into the message box of the WhatsApp App. That works on my iPhone. Maybe a security hole in WhatsApp but.....
Pasting is a user gesture, so it's reasonably safe, at least compared to things that might emulate user actions but don't actually require the user's engagement (or even awareness).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Custom keyboard

Post by bogs » Tue Nov 12, 2019 12:14 am

richmond62 wrote:
Mon Nov 11, 2019 12:20 pm
When I crank up my PPC G5 iMac running 10.4.11 the Metacard Prefs do NOT feature the "ScriptEditor" tab,
probably because I am not using the 3.5 IDE.
Actually, not so much. The reason you don't see it is because you are just not devious and bone headed enough to figure out how to find it.

Screen shot of Mc 2.2 where it was blatantly out in the open for everyone to see up to vers. 2.5 (or so) -
ksnip_Mc22.png
'dis mus be da place....
However, later on, the options visibility was set to 'false' (not sure why). Changing it to 'true' re-enables it in any version I tested it on.
ksnip_Mc4.png
Move this, lift that, shift the other thing over and...
richmond62 wrote:
Mon Nov 11, 2019 12:20 pm
Seem quite unable to get either of Jacque's Magic stacks to "do" the magic with LC 4.0 and a folder containing Metacard 2.4.
While I still don't have a stable Mac setup (and probably too much going on at the moment to even try to sort it out), you don't actually need the stacks Jacque made to run Mc on Mac (or anywhere else). You just have to move the folders/files as we discussed in the Mc topic. Least, that worked here on OSX 10.6.5, your mileage may vary on anything later.

@ Richard - I am not having an issue with what you said, as it makes some sense, however just about every Os I've ever used has a virtual keyboard program, Windows does, Linux does (several in fact), I can't test at the moment but I'm pretty sure Mac does as well. Every mobile device I've ever seen a picture of someone typing, they are typing with a virtual keyboard.

*IF* that is the case, I'm not sure why it would not be able to be tapped into, although my methods of doing so may wind up being pretty unorthodox, or may not work at all. If they don't work, I'll have learned something for sure :D If they do, I don't see the harm in exploiting it for simple text things. I've already found 3 ways of sending text to another program here on 'nix, albeit so far not in a direct 1 to 1 manner, mostly through issuing shell commands or using files.

However, that isn't the goal I'm shooting for, so I am pressing on. I was *kind* of right in what I thought about the "process" commands, starting a text editor that way doesn't seem to be any trick at all, it shows up in the list of openProcesses, it has an 'id' (nix only I'm pretty sure), however direct typing doesn't seem to be a possibility. I'm not sure I understand why not, all the examples I've seen seem to indicate it should be in a way, i.e. sending a string to the openProcess "processName" after opening it for text update. I am setting that method aside for a future look at.

@Tom - it is an interesting mind exercise for me, at this point I am really curious if it can be done or not. Thank you for bringing it up :D
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Custom keyboard

Post by FourthWorld » Tue Nov 12, 2019 12:59 am

bogs wrote:
Tue Nov 12, 2019 12:14 am
@ Richard - I am not having an issue with what you said, as it makes some sense, however just about every Os I've ever used has a virtual keyboard program, Windows does, Linux does (several in fact), I can't test at the moment but I'm pretty sure Mac does as well. Every mobile device I've ever seen a picture of someone typing, they are typing with a virtual keyboard.
Yep, OSes provide their own keyboards, and at least Android (maybe iOS, but I don't know for sure) provides APIs for third parties to make keyboards.

Those APIs could be used from LiveCode Builder, but LiveCode script has no direct support for them at this time, as I noted in my first reply.

If it were simple for an app to control input into another app everyone would be doing it, and the outcome in many cases wouldn't be pretty. If my app can control yours, I could probably do that without your direct intervention, or perhaps even your knowledge. And before you know it I've got you signed up for every expensive add-on every app on your phone offers, and I've sent all manner of embarrassing messages through all of your chat apps.

I've never needed to make a custom mobile keyboard, so I've never looked into those APIs. But given the implications, I'm guessing there are reasonable safeguards to prevent malicious Trojan Horse keyboards. But even if those protections are modest, the APIs would require LC Builder's Foreign Function Interface to use. I know of no command in LC Script that can seize control of text input in other apps away from the user.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Custom keyboard

Post by trags3 » Tue Nov 12, 2019 1:08 am

FourthWorld wrote:
Tue Nov 12, 2019 12:59 am
OSes provide their own keyboards, and at least Android (maybe iOS, but I don't know for sure) provides APIs for third parties to make keyboards.
There are numerous Keyboard Apps on the App Store. None of them have more than a single character or emoji per key as in a sentence or paragraph as far as I can tell.
When I can catch my breath I might look into LC Builder and the keyboard API's on iOS.
Thanks again for all the help I am able to get from this forum!

Tom

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Custom keyboard

Post by jacque » Tue Nov 12, 2019 1:25 am

But given the implications, I'm guessing there are reasonable safeguards to prevent malicious Trojan Horse keyboards.
Apple forbade custom keyboards for years until maybe 2 years ago or so. SwiftKey was anxious to get into the App Store, it's one of the best selling keyboards on Android. Apple finally relented and once the gates opened the developers swarmed in. I'm sure Apple reviews those submissions carefully.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Using Plugins for Customizing the LiveCode IDE”