Keyboard layout (OS X) - write a sentence with one character - macos

I am a web developer and use git and other small commands all the time in terminal. I know git goodies, how to use aliases, etc., but I was wondering whether it is possible to do it with keyboard layouts?
(1. Just for fun, 2. There might be other uses of it)
I managed to create keylayout file and substitute a character by a word, but I cannot get further than 20 (or so) characters. Does somebody know whether there is some limit on it? I played with maxout variable but it had no effect.
I hope I was clear on my question, might be a bit abstract. https://developer.apple.com/library/content/technotes/tn2056/_index.html
Thanks in advance!

Not sure if you ended up figuring this out, but I'm right there with you—couldn't figure out a solution, trying to input 30 or so keys seems to crash whatever application is open, and relaunch Finder. Bit of a shame, although you could try using text replacement? It's under System Preferences > Keyboard > Text, I've been using that for misc things that I was too lazy to slap on my keyboard.
Key replacement doesn't seem to have a limit, although it might and I just didn't notice. Bit of a bummer, seeing as I'd prefer to hit "Alt-B" instead of typing something like :replaceme:, but it seems to get the job done. Doing some quick testing revealed no problems outputting 2,000 chars via text replacement, although after that it seems to hit some sort of limit (2048, maybe). For now, though, this seems to be the best solution.

Related

How to create custom single byte character set for Windows?

Windows uses some encoding table for non-unicode applications to map characters from unicode table to 1-byte table. There are many predefined character sets, user can choose one in windows settings. I need to create a custom character set. Where can I find some information about that process? I tried to Google it, but didn't have any luck, I guess, few people are doing that.
AFAIK, you can't do that, I don't think there's even a way to write some kernel mode "driver" for it, but, haven't looked into these things for a while, maybe there is some way (now).
In any case, you might be better off using a library you can change/update, such as libiconv.
UPDATE:
Since you don't have the source code, you're in a very unfortunate position.
For all string resources (in EXE or any DLLs or, though unlikely, in some other file(s)), you can "read them out" and figure out what's the code page used in them and change it (and the strings themselves), tweaking it in some way that would achieve your purpose - to have the right glyphs appear (yes, you might actually see different glyphs in Notepad, but, who cares if you application shows the right one(s) - FWIW, for such hacks, it's best to use a hex-editor). Then, of course, "put" the (changed) resources back in (EXE/DLL). But, it's quite possible not all strings are in resources, and that's when the "real" problems start.
There's any number of hacks that could have been done here. Your best option is to use some good debugger (WinDbg or better) and figure out what's going on and how are character sets handled = since you don't have the source code, it's gonna be quite painful. You want to find out:
Are the default charset(s) used (OEM/ANSI), or some specific (via NLS APIs)?
Whatever charset is used, is it a standard one or not? The charset here is the "code" Windows assigns to it. Look at Windows lists of available charsets.
Is the application installing fonts? If it is, use a font tool to examine them - maybe it has a specific (non-standard?) code-page supported in it.
Is the application installing some some drivers. If it is, the only way to gain more insight is to use a kernel debugger (which is very tricky and annoying, but, as already said, you're in an unfortunate situation).
It appears that those tables are located at C:\Windows\system32*.nls. I'm not sure whether there's proper documentation for their structure. There's some information in Russian here. Also you might want to tinker with registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls

Colorized output in the swipl-win (SWI-Prolog) window

What I'm Doing
I am currently working on creating a SWI-Prolog module that adds tab-completion capability to the swipl-win window. So far I've actually gotten it to where it reads a single character at a time without stopping/returning anything until a tab character is typed. I have also already written a predicate that returns all possible completions of an incompletely typed term by using substring-matching on a list of current terms (obtained via current_functor/2, current_arithmetic_function/1, current_predicate/2, etc [the predicate used will eventually be based off of context]).
If you want to see my code, it is here...just keep in mind that I'm not exactly a Prolog master yet (friendly tips are more than welcome).
What I'm Thinking
I've long abandoned any efforts at using XPCE to do popup-dropdown-completion in the swipl-win window (I'll eventually try to get that into Pce-Emacs [it won't be as polished as Visual Studio --picture something more like Python's IDLE], but I don't know if that's really even practical since I'm starting to use actual Emacs a lot more nowadays anyway), but is there any way to modify the output color in the swipl-win window? I know syntax highlighting has already been implemented in other Prolog systems' command-prompt windows, but I really just want to have it so that when tabber.pl suggests a completion, it also shows the arity (and perhaps the rest of the partially-typed term) of the suggested term in light gray. I know there is already color output from the system (like when it starts up), but I don't know how to hook into output stuff to control it myself. (Obviously, I'd probably define print/1 but...)
I know I could write my own SWI-Prolog console like one guy has done with C#, but I really wanted it so people (including me) could just load the tabber module somewhere in their config file and continue to use the swipl-win window, rather than having it be a completely different executable... Would I have to use some kind of C API?
Note:
The actual implementation will likely be influenced by the answers that I get to this question, because I'm going to base my decision on the use of strings and/or atoms in this project off of them.
What I'm Asking
Is there a way or something (even if it's really low-level) I can implement to colorize output in the swipl-win window?
AFAIU the question you have to deal with is to avoid calling the fontify-function every seconds as common buffers do. I.e. call it only once when output arrived and restrict fontification to previous prompt in buffer.

Keystroke in AppleScript maps numbers to those on keypad, which cause some problems

I need to send some keys to another program, and I tried keystroke in AppleScript. Everything worked well until I found that when I sent numbers to a Windows program running in Parallels virtual machine, it didn't work, but instead, it change the position of cursor.
Then I use program keyboardSee to find what's wrong, and I found that all numbers and some symbols are mapped to the keys on numeric keypad, not the numeric line. So maybe the NumLock is off in the virtual machine, and the keys mapped to keypad trigger not numeric but control keys.
I found some people says that use key code can solve this problem, but I cannot find a perfect char-to-keycode table, and I also notice that people said key code could be different for the same character in different keyboard layout.
So how can I solve this problem perfectly, means how can I make it always map numbers to numeric line, and perform the same in no matter what keyboard layout?
I'm afraid to say that I don't think this is possible at the moment. In general, Mac apps know that macs don't even have the same characters on their Numberpads that PCs do (no arrows, no num lock, etc), so the distinction is meaningless. Some poorly ported Mac apps do make a distinction though, such as World of Warcraft (although it isn't the worst port out there by any means). I believe parallels has a num lock in its menus somewhere (if I recall correctly), so you should be able to get around it that way.

Is there a utility to cue up several strings for clipboard pasting (for step-by-step code presentations)?

I was at Apple WWDC in 2008 and all the engineers used some sort of utility to cue up 10-20 lines of code for easy pasting, one at a time. They used this to demonstrate code construction on the fly. It let them avoid having to actually type any Cocoa code in front of the large audiences.
I'm looking for a similar utility for doing screencasts. Anyone know of a good program that lets you cue up / manage multiple strings of text for easy pasting?
UPDATE: The program needs to be for Mac OS X.
For those window users out there who see this question, use ClipX
For Max OS... hopefully someone else is more useful than I can be.
Unfortunatly, I don't use Mac OS, but a quick search revealed this:
http://theappleblog.com/2009/06/02/10-clipboard-managers-for-os-x/

Should I worry about putting a large amount of data on the Windows Clipboard?

If you try to close a Microsoft Office application when you've got a ton of its stuff on the clipboard (e.g. a whole word doc), it prompts you to ask if you would like to access that data after the application is closed.
In this day and age, does it really matter if I have say 10MB of stuff on the clipboard?
As I write my image processing app, should I follow the same rule as Office, or just forget about it and leave the data there?
Personally, I favor just forgetting about it and leaving it there. I've always found the MS Word approach more annoying than useful.
The reason word is asking about this is that it uses Delayed Rendering for the clipboard. This allows word to only create the formats that are requested upon a paste operation. However, any formats on the clipboard that were created with delayed rendering will disappear if the program exits without rendering them. In the case of excel, rendering thousands of empty cells in RTF would take megabytes of space, even though the actual data is tiny. Thus it asks whether you want the data rendered to the clipboard or if you're fine with losing it.
For your own application, the question then becomes: should I use delayed rendering? The answer depends on how long it take you to render in the various formats you'd like to support. If you're only supporting one format that renders quickly, odds are there's not going to be an advantage to delayed rendering.
If you're storing things on the clipboard without the user requesting it then you might just annoy a few people :)
Otherwise, yeah, just leave the data there.
How To Erase Windows Clipboard Data and Why.
any one who has access to the computer can easily see the clipboard information.
I'd guess, malware today would also be snooping there.
this question might be more suitable on superuser.

Resources