A lot of techies are surprised when I say I mostly use Windows.
Why would anyone who writes code and edits video use Windows?
Two reasons: one, it's cheaper.
And two: it lets me bodge.
So sit back, 'cos, yes, I'll tell you how I made the emoji keyboard,
but more importantly, I will tell you about the art of the bodge.
Bodging is a wonderful British word that means to patch together, to make temporary repairs.
A bodge is clumsy, it's inelegant, it'll fall apart, but it'll work.
And it'll keep working as long as there's someone around to bodge it again if it breaks.
You know that bit in Apollo 13 where they have to fit the square peg in the round hole?
That is a bodge. Actually, that's possibly the greatest bodge in human history.
In fact, if you can think of a better one, let me know in the comments,
'cos there's probably a book on Great Bodges of History
to be written there, and I'd quite like to be the one to write it.
Anyway. Bodging has always sort of been how I make things.
I didn't study computer science, I'm not writing elegant solutions here,
I patch things together.
The important stuff-- backups, password security-- I make sure I get that right...
but stuff I'm making for fun, I bodge.
Now I learned to properly Bodge when I was filming a TV show a few years ago.
Some of that show's made it online, I'll put links in the description,
but stick with me for now, 'cos you need to know some context about it.
I was filming with two people. Colin Furze, who you might know off YouTube, he makes ludicrous,
big, exploding physical things, and he has the land speed record for a mobility scooter.
And then there was Charles Yarnold, who makes
intricate microelectronics with Arduinos and circuit boards.
Like, last year Charles made Barack Obama's Christmas tree.
And people could go online to customise the colours and patterns
of the twinkly lights that went up and down it. It was wonderful.
And my job on the TV show was to be the bridge between those two, between Colin and Charles,
to get the creations that they physically fabricated
working with the world and with each other.
So when we made a remote control for a horse --
I'm not kidding, we made a remote control for a horse --
Colin built the framework for a robot jockey,
Charles made all the circuits and relays to have it pull the reins when it got signals,
and I built a smartphone app that let you send those signals to let you steer a horse.
And it worked!
And I probably had the easiest job of the three of us, 'cos when I made things,
I had an undo button.
But the key part was this: we were building prototypes.
They had to work for one day of filming, and we'd be there for it.
But they HAD to work on that day, or the TV show would be terrible
and we'd have wasted a lot of money. And we had basically no time to build there.
We were working 16-hour days, 7-days a week, and by the end of production,
we had no time. We were bodging.
And the bit of software that helped me, on that show and since, more than anything else,
was called AutoHotKey.
AutoHotKey is such a good bodging tool that it sometimes gets detected as a virus.
AutoHotKey was originally meant to be really, really simple:
it waits until the user presses a certain key,
and then it starts a program, or it types some longer text,
or it presses a more complicated series of key commands that'd be really difficult otherwise.
Like, if you wanted your F10 key to make your video game character suddenly spin 180 and fire?
Got it. No problem. AutoHotKey was it.
The thing is, AutoHotKey grew and grew and grew and grew.
And its scripting language, the stuff you have to write in to make it work,
is terrible. I mean really awful.
It was meant to do just really simple things,
and over time it's gained the ability to do so much.
It can read files, it can look at the colour of individual pixels on screen,
it can call arbitrary Windows DLLs,
it can parse regular expressions, for anyone who knows what those are.
But it's all in this weird non-standard way that is inspired by Visual Basic.
AutoHotKey is a bodge that helps you make other bodges.
But it works!
And it means that instead of having to spend hours of time
diving into complicated operating-system-level stuff,
you just write a few lines of script and it does the job.
I used AutoHotKey, on the TV show, to control the release of a skydiver's parachute.
And it worked. I mean, really well. I mean, we had a reserve, but it worked.
The greatest bodge I ever pulled for that TV show involved, and I swear this is true,
a voice synthesiser and a copy of Sibelius on a Mac
being remote-controlled by AutoHotKey on a Windows PC,
which was blindly dragging the mouse around
doing pre-recorded movements through a remote desktop connection,
while another PC fired commands to a Google Chrome window open on the Mac over Wi-fi,
because AppleScript and all the similar tools for Mac that we needed to run on Sibelius
just weren't up to doing something that ridiculous.
By the way, if anyone out there suggests using Linux... no.
The world loves emoji.
I mean, seriously. Individual people might not, sure.
I don't really use them myself, despite the keyboard,
but the world loves them. People click on headlines about emoji.
Just putting the word in a headline means you get way, way more hits on it.
Emoji is basically the Donald Trump of computers. There's a joke that won't date well.
The very name is clickbait, you don't really need anything else on top of it.
My friend Matt -- who's behind the camera right now -- say hi, Matt.
[MATT: Hi!]
Matt and I made an emoji-only messenger last year. And hardly anyone used it.
Huh. That's not true.
Loads of people used it... for about five minutes
before they realised it was utterly impractical and never opened it again.
But you should have seen the press coverage, the emails we got!
We even got confused investors thinking it was a startup
and emailing us to talk about equity.
So this year, movie studios were bidding on an emoji-based pitch.
Not mine, sadly. I wish I'd thought of it,
because they got nearly a million dollars for it.
The world loves emoji.
And here's the thing: the concept of emoji, as we know it today,
as is on this keyboard, is a bodge.
You know, you might know the story.
Around the world, every language had a different way of translating
between letters and binary code, 1s and 0s, for computers.
Now Japan had a bit of space in its text encoding scheme,
they've got a lot more characters than the Latin alphabet anyway,
so adding a few more wouldn't really have been a problem.
And some clever engineer thinks, "Hang on,
"we can put little pictures in our text encoding, we can let people send those,
"and we can send pictures without actually having to send pictures
with all the bandwidth that entails."
So there are a few competing versions of that,
but they never left Japan until the Unicode Consortium came along.
Now, the Unicode Consortium's job is to go to every country
to work out how they encode text into binary,
and turn all of these hundreds of competing approaches into one big worldwide standard.
The most amazing thing about it is that for the most part,
they actually managed to make that work.
But Unicode was meant to be two-way.
You convert text into Unicode, then convert it back out
into your country's old legacy system, and nothing should be lost.
So the Unicode team get to Japan and they go, "Oh, you've...
"You've put pictures in your text. Okay, um...
"We can deal with that. We'll add them to the standard as little glyphs.
That's fine. We had a smiley face in there anyway. No-one'll notice."
And no-one does notice, really, for a while, until Apple, who want to sell iPhones in Japan,
quietly add emoji as a... a fairly hidden option.
But as soon as one person notices,
"Hey, I can send little piles of poo to my friends."
All their friends go, "Oh wow! How do you turn that on?"
And suddenly you have this kind of ready-made viral explosion of piles of poo.
Which I guess is norovirus.
So suddenly the world has emoji, and America is all, "What the hell are these?"
'Cos they're used to having consumer electronics, text encodings, everything...
designed by America, for America.
They have no idea what the cherry-blossom stamp is,
or why there's a rice ball emoji, but no burrito.
And they have no clue what a love hotel is. Don't ask.
'Cos bear in mind, these original ones were designed decades ago,
in Japan, for Japan, and there were originally only about 100, maybe 150 of them.
And America's like, "Why can't we have a burrito emoji?"
They mostly think it's an Apple thing, not a international standard thing,
so the Unicode Consortium suddenly finds itself having to bodge in new emoji.
And they have to bodge in the flags of all nations,
which is a really clever approach where you're actually sending
letters for country abbreviations, but that's a separate thing.
Then they realise every phone supplier has made the default emoji either yellow or just plain white,
and realise they have to bodge in what are now called skin tone modifiers.
And let's face it: a one man, one woman, one boy, one girl family is really stereotypical,
so they make it so you can use something called a zero-width joiner to
any person characters you like and they will come together into a single family emoji.
You can do that with shift on this keyboard, by the way, which I'm really proud of.
And I know, I know someone out there is about to comment,
"Ooh, it's political correctness gone mad."
No. No. To hell with that. To hell with that.
These are meant to be international.
These are meant to be cross-cultural, for everyone on earth.
There had damn well better be those options,
and thankfully, we are more or less there.
But the emoji we have today weren't designed as one worldwide thing.
They're a bodge on top of a bodge on top of a bodge.
Cleverly done and standardised, sure,
but they're a patchwork of rules.
They've even got Wingdings in there now.
That's why there's Levitating Man in Business Suit,
because that came from an American decision.
And the latest version of iOS does have a custom version of that in.
You might even be able to add a skin tone modifier to it, I'm not sure yet.
So I get the idea for a physical emoji keyboard.
I thought about trying a full-Unicode one,
but I realised I would need hundreds and hundreds and hundreds of keyboards,
but you can just about fit all 1,200 or 1,300 or so emoji
that are currently out there onto 14 keyboards. So they're all here.
Actually getting the stickers to print correctly on my home inkjet was a bit tricky,
but I got there, it was just a matter of lining everything up properly
and then spending several hours sticking the damn things on.
And thankfully, you can just plug 14 USB keyboards into a Windows machine, through USB hubs,
and it'll go, "Yeah, alright. I've got 14 keyboards now. That's cool."
But the trouble is: all 14 keyboards, as far as most programs here are concerned,
are counted as the same keyboard.
You don't get to see which Z key's been pressed,
you just know a Z key has been pressed somewhere.
And even AutoHotKey, my old reliable standby, couldn't help me with that.
So I started looking around for solutions.
And there are low-level APIs, programming interfaces,
in Windows that let you see the raw input as it comes in over the wires.
Mac and Linux folks in the comments, are going to be going, "Oh yeah...
All you have to do is connect the flumberboozle to the GKX virtual port, then write a--"
No. No. Not going to do that.
Because I got to the point of installing Visual Studio on this
and thinking of actually learning the low-level stuff
and I thought, "No. I run Windows. Someone will have done this before."
And sure enough, they had.
Of all things: there is a program called LuaMacros,
and it's meant for the flight simulator community.
Flight simmers are amazing, they will build entire fake cockpits
with a hundred switches in them so it's all accurate.
And if they can't afford that, they'll want to plug in multiple keyboards
so it at least feels a bit like they've got a fake cockpit with a hundred switches.
And so LuaMacros exists, and it's wonderful.
Because it is basically a modified version of Lua,
which is a weird but not too weird programming language,
with a load of extra functions grafted in to handle detecting different keyboards and keypresses.
And because it's a full programming language, you can do full-on programming in it!
Which is fantastic! I mean, I was overjoyed.
Like, literally, dancing around my flat when I first downloaded and ran LuaMacros.
Which was partly because I was really happy,
and partly because I had Aqua's first album on, but that's beside the point.
I could detect individual keys from individual keyboards. Great!
So here was the plan: get each key's code.
That's the number that gets sent to the operating system when it's pressed.
Put those in a list, from top left to bottom right, all the way down one keyboard,
ignoring the complicated ones like Enter, Control and Alt.
Then, when a key gets pressed, take the code,
look it up in that list. Remember what position it is.
Then add to that the total number of keys in that list
multiplied by the number of the keyboard it was pressed on.
So if I hit the fifth key on the second keyboard, that would come through as item 4 in the list
and keyboard number 1 -- because computers and programmers count from 0.
So: fifth key. 0, 1, 2, 3, 4.
Second keyboard: 0, 1.
Plug all that into the formula, and you'll find where you are on the list.
And the reason we count from zero is because it makes maths like that so much easier.
Keyboard 1, times the 94 keys in the list, plus 4,
means you want the 98th item on a list starting from zero.
The equation is just so much simpler...
and it didn't work. It didn't work.
It took me half an hour to find out why it didn't work,
and the reason it didn't work is that Lua,
unlike every other programming language in modern times,
counts from 1, not from 0!
Half an hour. Half an hour that took me.
I fixed the equation, and it worked. So I loaded in the full list of emoji,
in the order that I'd put them down on the keys,
and I told LuaMacros, "When you get a key,
"calculate that number like we just did,
"look it up in the big list of emoji, go down that many lines,
and type that emoji."
And it didn't work either.
'Cos there are no emoji keys on a regular keyboard. Of course there aren't.
No-one has been ridiculous enough to make an emoji keyboard yet.
So there isn't a key combination that will get you an emoji.
Alright. There might have been swearing at this point. Just a little.
So. Okay. What next? Well, it turns out that Windows has a way of writing special characters,
and quite a few of you will remember it: you hold down the Alt key,
and you type numbers on the numeric keypad.
That's not even from Windows, that goes all the way back to original
IBM PCs and BIOS and DOS, okay, it's decades old. But it still works.
Because Microsoft is obsessive about backwards compatibility.
You can still type those like it was the late eighties.
But then they realised, "Oh, now we've got all those Unicode characters,"
so they used a bodge. They extended it to Unicode.
You do a quick registry tweak, you can type Alt, plus sign,
and then a Unicode code point, and it will type it, all the way up to emoji! Hallelujah!
And I got that working, and it threw emoji into Microsoft Word. And I was laughing.
And then I tried it in a web browser, like for Twitter, and it didn't work either...
because that backwards compatibility means that Unicode code points only work in rich text boxes,
things that allow formatting, not plain ones.
Couple of hours went by at this point. Nearly there.
I got quite frustrated. And I took a break,
and I swear, at some point while I was cooking dinner,
it was like a light came on in my head,
and the gods of bodging shone down upon me and I shouted out loud, "AutoHotKey!"
Yeah, that wasn't just a pointless ramble about bodging earlier with AutoHotkey. AutoHotKey.
Because it can't tell which keyboard is being pressed, that doesn't matter.
What it can do is type emoji. It can look down the list of emoji,
it can read a particular character from a line, and it can enter it anywhere,
'cos it doesn't use key presses, it uses low-level Windows stuff.
So. I have one program, LuaMacros.
It can read the keyboards and work out which emoji the user wants.
And I have one program that, if we already know which emoji the user wants...
can type it.
So it was bodging time. Here's how this keyboard works:
You press a key. LuaMacros intercepts it on the way in,
stops Windows actually typing the letter or whatever's underneath it.
It works out which number emoji you want, and it saves that number to a file on disk.
Then, it presses the F24 key. That's right, there's an F24 key.
It's not on my keyboard, it's almost certainly not on your keyboard,
but it's still a key that Windows can deal with because backwards compatibility.
And AutoHotKey is listening for that F24 key and when it hears it,
it reads that same file, the file that LuaMacros just put the number in, it reads that number,
it looks down the list of emoji, and it types that emoji!
That is how the emoji keyboard works, that's why I use Windows,
and that is the art of the bodge!
One take!
Thank you, Matt!
[Translating these subtitles? Add your name here!]