What software program can I use to build a custom desktop keyboard IME for MacOS? - macos

I would like to make my own version of Mac's ABC-Extended keyboard for typing Pinyin (a way to write Mandarin that indicates tones). But when I use Xcode, I just see a target custom keyboard extension for iOS and nothing for macOS. I've looked into the program Ukulele but it doesn't seem like it will do everything I need. Theoretically I could also put my rules into files like how this article indicates but that also seems cumbersome based on what I want my keyboard to do.
Here's what I want it to do:
First option: user literally types "ni3 hao3" and my logic in real time changes their output to "nǐ hǎo" (there are pinyin/grammar rules for where the tone mark goes)
Secondly (phase 2 in my project), in their user settings for the keyboard, they could indicate they want to convert their text to Hanzi (the characters). So when they type their Pinyin, my algorithm guesses a best guess list of Hanzi characters that matches their Pinyin entry. This would require that I have a downloaded dictionary file for my keyboard.
Thanks for any help! I know how to program it I just need the right software to use :(

Related

Keyboard shortcut for a repetitive sentence

I'm currently saving 200/300 PDFs a day (work related), they all have a sentence in that's the same, I'm unable to use Ctrl C/V as I have to copy other parts before saving.
Is there a way for me to have a keyboard shortcut that puts the sentence in for me when saving the file?
(Windows 7 and limited admin access)
Many Thanks,
L
You could use a Macro editor which records keystrokes and repeats them.
This one is a free portable example (doesn't require an installation).
https://portableapps.com/apps/utilities/tinytask_portable
On windows 7 you can only have one Item in the Copy&Paste Memory, so there is no other easy way than to simulate keyboard input. You can also "Drag and Drop" the sentence from somewhere else (like a website) by selecting it and then clicking on it and dragging it into the Document.
Maybe that works better for you.
I'm not sure I've understood completely your problem, but in all likelihood a clipboard manager would suit your case.
They don't (usually) allow you to have a sentence inserted automatically before saving, but they let you save many instances of "clippings" and paste them conveniently.
There are a lot of them, I personally like Clip and used also ClipX and Ditto.
Many of these clipboard managers include features to associate a specific hot key to insert a specific snippet of text.
There also programs that are focused specifically on that HotKey -> specific snippet functionality, or that include it among others.
Also, if clarified what software you're using to do these "pdf savings", it would help (it's possible that it does include facilities to include a sentence before saving).
And in any case you can almost for sure do what you want with a macro/scripting utility such as AutoHotKey (but it would usually be pretty complex if you're not already familiar with it).

Translating shortcut keys

When extracting strings from a desktop Windows application for translation, should I translate shortcut keys as well?
In other words, should Ctrl-C copy to the clipboard even for Chinese software?
Yes, CTRL-C is universal. You can safely assume that typical CTRL-something shortcuts behave the same in all (modern) Windows versions, regardless of the language.
However, there might be several ways to present them depending on the language. For example, French would translate the name of the key (the combination remains the same).
But you are asking about Chinese (presumably Simplified Chinese), which will simply display it as CTRL-C. After all, the keyboard layout is the same (with the same symbols), all they do differently is they use so-called Input Method Editors. And although there are several different IMEs, I haven't yet seen the one that would override CTRL-C...

Remove decimal point from on-screen keyboard

According to this document, numeric keypad on Windows Phone OS 7.1 is ought to have "." - decimal point.
Is there a way to remove the decimal point from keyboard, leaving only numbers and Backspace sign?
There isn't a way to customize the soft input panel further than the various InputScopes. You could, however attempt to simulate the SIP, but that seems like a lot of extra work just to avoid the ".".
Here is one example that might be of help if you choose to go this route: http://www.silverlightshow.net/items/Windows-Phone-7-Creating-Custom-Keyboard.aspx
Rather than attempt to modify the built in keyboards (which you can't do) or attempt to create a custom keyboard (which is a lot of work to accurately recreate the native experience) you'll probably find it much simpler to just ignore the characters you don't want displayed.
Use the TextChanged event to check for the period and ignore it.

Windows text editor that shows/hides lines based on RegEx or Grep syntax?

One of my application components produces some extremely hairy log files. They require a lot of poking and prodding before they produce useful information. I'm on the hunt for a text editor for windows that will let me enter text in either RegEx or Grep-style syntax, and automatically show/hide the relevant lines.
Does anyone know of a text editor that has this feature?
Thanks!
IVR Avenger
I know it's answered already, but http://glogg.bonnefon.org/ is the perfect answer for this. Couldn't live w/o it.
I would recommend Notepad++ as far as a good all-around Windows text editor is concerned - it is very extensible and includes just about every power feature you need to wade through data logs. If your log files are in a well-defined format, you can even use the built-in language editor to define a custom visual scheme for your logs - easier on the eyes.
-matt
GVim with for example, :g command. There are also plugins that allow entering search criteria, and they show relevant lines, and fold everything else.
Emacs, of course (occur), but I think pretty much every editor will do this.
Another option is SlickEdit using it's "Selective Display..." option
Although it wont show/hide based on a regex, Textpad will allow you to search and produce a hyperlinked result file with the lines that will allow you to click into the actual log. Consider the benefit: You can keep the filtered results up on your left monitor, and you can click into the full files and show them on your right monitor to see the context.
SPFLite is free and does just what you want. At least the IBM SPF and ISFP (used on IBM mainframes as part of the MVS operating system) that it emulates is just what you want.
From what I have tried, SPFLite will probably do the job. It can X (exclude) all lines from view, or eXclude lines with a given character or phrase (optionally starting in a certain column) from view. Or after eXcluding all lines, you can display, by Finding, characters or strings (optionally starting in a certain column). I think it also has a macro capability. The original does, and I think this Lite does as well. How robust I do not know. The original could create interactive screens and programs using the MVS TSO Command Language.
I found SPFLite at http://www.spflite.com/
I found that this interface is not so easy to use, but one gets used to about anything if necessary.

Reuse Edit Control as Command Window

This is a GUI application (actually MFC). I need a command window with the ability to display a prompt like such:
Name of favorite porn star:
The user should be able to enter text after the prompt like such:
Name of favorite porn star: Raven Riley
But I need to prevent the user from moving the cursor into the prompt area. Users should also be prevented from backspacing into the prompt in order to prevent the following:
Rrraven Rrrileeey Ruuuulez!!! Name of favorite porn star:
Also need to control text selection and so on. And finally, I should have no problem retrieving only the text the user entered (minus prompt text).
Will it be better to create my own window class from scratch (i.e inherit from CWnd) or should I reuse the Windows EDIT control (i.e. inherit from CEdit)?
A similar command window can be seen in AutoCAD and Visual Studio (in debug mode).
I think you'd be better off creating a subclass of CEdit and limiting filtering key-presses. I suppose the hard part is not letting the user move the caret to the prompt area, but you can probably write some code to make sure the caret always get sent back to where it belongs (the input part).
Anyway, if you really, really want to implement your own control (it's not that difficult after all) I recommend you read Jacob Navia's "technical documentation" on how he built the LCC compiler and environment. Actually, it seems the docs are not online anymore, but I'm sure you can get them through his e-mail (jacob#jacob.remcomp.fr).
Edit: I liked your previous example better. Keep it classy, LOL :)
I had a very similar requirement and did exactly what davidg suggested; subclassed a edit control and filtered key presses. This was actually using Qt not MFC but the principle will be exactly the same.
You need to remember to filter keys such as home as well as left and backspace. I just checked to see if the move would move the caret into the prompt and if it did ignored the keypress.
Another thing to watch for is pasting multiline text, you will have to choose whether to just paste the first line or all lines, adding the prompt on all lines after the first. When subclassing the control you get lots of behaviour which won't work exactly as you want it.

Resources