Convert TextExpander Snippets to iOS/OS X Text Shortcuts
TextExpander Snippets to iOS/OS X Text Shortcuts
Here is something I’ve been working on for quite a while now. I first had the idea for this when I went to Vienna. I was annoyed that Apple still didn’t allow TextExpander to do what I love it to do. Three weeks ago it looked bad for TextExpander already, now, a couple of weeks later, it looks even worse.
Since Mavericks, Text Shortcuts (System Preferences → Keyboard → Text) sync with iOS devices. I started thinking how to automate adding new shortcuts by script. Scripting the UI is, obviously and technically, my least favorite option, but it’s what I ended up doing.
If you are interested in the technical difficulties that I had to overcome, which make this script work the way it does, read on. Otherwise head to the end to download.
How OS X Text Shortcuts Work
When a new Text Shortcut gets added in the System Preference pane Keyboard → Text, OS X does a couple of things.
First it saves a “receipt” of this addition/removal to ~/Library/Mobile Documents/com~apple~TextInput/ in there are a couple of folders. Most important are those with your username. Open that folder and you see UserDictionary with a subfolder. Select the ones with “~” in their name.
Every time you add or remove a new shortcut a zipped plist will be saved here, containing an Epoch timestamp, the shortcut and the phrase (as Apple calls expansions). Some other data is in the plist as well, but the important bits are the ones I just described.
The other important folder is in ~/Library/Dictionaries/CoreDataUbiquitySupport. This folder looks similar. It contains two folders, somewhere you will find a UserDictionary.db file. This is a SQLite database.
When a new shortcut gets added, a new row will be created here. Again Epoch timestamp, shortcut, and phrase are the important pieces.
What Does Not Work
My first guess was to add new “receipt” files to Mobile Documents. I was hoping that OS X would realize there’s a new file, read it and add it to OS X Text Shortcuts, and that this would also transfer new shortcuts to an iOS device. It does not.
Adding new files here with a similar structure does not update the System Preference pane Table View, nor does it make an iOS device recognize the addition.
I started tinkering with SQLite then. The SQLite database in Dictionaries is only used to feed the Table View displayed in System Preferences. Add new rows here with a similar structure, restart System Preferences, and you will see the new shortcut. Editing the database files does not trigger iCloud to sync shortcuts.
At this point I was pretty disappointed and took my least favorite route, UI scripting. I know it’s hacky, I know it’s dirty, I know all that, but scripting the UI lead to a working solution.
Maybe looking a bit more into Mobile Documents would eventually have resulted in a better solution. I weighed the time it would take me to figure this out against the time it takes me to make a first running version. I prefer things to be done.
How This Script Works
PLEASE READ THIS, IT IS IMPORTANT! ALL YOUR EXISTING SHORTCUTS WILL GO POOF!
Open System Preferences → Keyboard → Text
Click the Table View, select all, press backspace. This deletes all existing shortcuts and takes a moment or two.
Turn off TextExpander text expansion. This is important. Otherwise when the script types the phrase, TextExpander would expand the abbreviation.
It will then compile a list of all your TextExpander snippets.
The script will then click +, type out the abbreviation, ⇥ to the next cell, paste the expansion from the clipboard, press return.
After it has completed typing all shortcuts, TextExpander text expansion will be turned back on.
A few things to note:
As the script automates the UI, just sit and watch. It takes about 4:40 minutes to type in about 300 snippets.
The clipboard is used, because this way the expansion can have multiple lines.
This script is smart enough not to process any dynamic snippets. Dynamic snippets use date calculations, Fill-Ins, and any script snippets.
It takes a while for the list of snippets to be compiled. If AppleScript Editor says “Running…” at the bottom, the script is still running.
If you hear an error beep you may have luck running the script again. Sorry this happens sometimes, I couldn’t figure out why.
Set all snippet groups that you don’t want to be added in disallowedGroups. The name must match the snippet group’s name.
If you want to know how many snippets you have, comment out the part where the script starts adding all Text Shortcuts. There is a line
log "Count of abbreviationList: " & (count of abbreviationList)
After I got diagnosed with hyperactivity, I learned how to meditate. I still call it that way, because it makes it easier for people to understand what I’m doing, when I hide in the closet for 15 minutes. What I really do is known as PMR, progressive muscle relaxation. It is a way to relax one’s body through flexion and relaxation of muslce groups. Science shows it’s quite effective on people with hyperactivity. I can tell from my own experience that this is true. I still “meditate” about once daily. Though, surprisingly, not on weekends. I don’t know why, but for some reason I prefer not to meditate on weekends. I call it meditation, because all the benefits commonly known from “regular” meditation, I get from PMR as well. The quieting of thoughts, the transcendency, the ability to isolate thoughts and feelings, etc.
Since I started my journey into becoming a calmer self, I also learned a lot about spirituality, Buddhism, forgiving, our nervous system, muscles, and many other things going along those lines. My (back then not) ex-girlfriend started a career as yoga teacher. That was one of the things that got me into spirituality in the first place. I’m still very glad I came across Fully Present. This was one of the best reads I ever had on this topic, mainly because it is written from the scientists eye, analyzing the science behind meditation and spiritualism. Recently I met a new friend. We were eating out and she told me she thought that I seemed to radiate a certain kind of calmness. “Calm” wasn’t a term anybody would have used to refer to me some time ago. It shows how long a way I have come. I was always, and luckily still am, a very energetic person. That’s just something you get for free by being hyperactive. You are very upbeat, your mind goes quick, and your body wants to move all the time. I found that balance is absolute key to calmness and being quiet.
It is because I allow my body to perform (sort of) intensive workout, it is because I allow myself to freak out, it is because I allow my heart to beat, it is because I allow myself to have emotions, that I am able to be slow, calm, and relaxed, when I need to. See, I wasn’t like this when I started out, I decided for it. I still need to decide for it, every single day.
What I learned from PMR is relaxing groups of muscles at will. The way PMR is performed: you flex, say, your forearm, you concentrate on that flexion, then you let go, and feel into the relaxation. If you do this a certain time, you suddenly feel where muscles are tight. Again, when some time passes after that, your can turn off tight muscles from your head. When I feel a cramp or something like that now, I go “let go” in my head and the muscle relaxes. It is mere exercise that allows me to do that. There’s no magic formula, just pure doing and doing. When I sit in front of a beautiful woman, I go: “stay calm, relax”, in my head, and my body does what it has been trained to do. It is just execution, execution, execution, but my head needs to set the trigger. I need to be aware of the situation, I need to be there when I want to be that way. The way hyperactivity works is, is it pulls you away, constantly, into the rabbit hole. I need to realize: “Am I still relaxed or is my body starting to go too quick? If yes, what can I do about it right now?” This kind of thinking has helped me in many ways, not just for my own safekeeping. I feel situations that I’m not aware of. I feel where I am distracted and think of other things. The barrier where I am able to make a conscious decision, to be aware, has lowered. The problem is I suddenly also feel all the situations that I am not aware. Things that are automated. Sad sometimes. Think of the last time you said “love you” to your favorite person, and just said it because that’s what you did for the last couple of years. What if that person suddenly dies. Wouldn’t you want that last moment you saw them to be special? That’s what awareness does to you. Cruel, in a way.
What also helped was having strict rules about what can be and what can’t. Planning, planning, planning. I was a planner ever since I got out of uni, almost 8 years ago, but planning has become a tool that I can use to prepare my body for moments where it can do its things, and when I need to have control over it. It also helps me to structure things. I am sometimes worried about the amount of stuff I plan and the rigidity of planning. But it is that rigidity that helps me to go into automation mode. I need to have this structure, it needs to be strict, otherwise I couldn’t perform so well. I don’t do this all the time, because as I wrote earlier, balance is absolute key. Where structure is, there is chaos. I have days that I don’t plan at all and I preasure these days just as much as those that are planned. I set priorities and areas of focus, that’s what gets me started. Planning is key to keep balance. I learned after my break-up how much of our relationship was part of my balance. I needed some time to figure out how to keep balance again on my own.
A word on drugs. I am still against taking drugs. When I met my coach back then, he said: “Take the drugs, that’s the easy way out, but you’d probably have to take the drugs for the rest of your life. The second option would be to work on the root causes. This takes more time and effort, but you wouldn’t have to (buy and) take drugs.” My answer is obvious at this point. What he didn’t say was that I would have to take a different “drug” for the rest of my life, every day (apparently not on weekends though). I prefer to take this drug, because this journey has given me so much. There’s an entirely different way of thinking about things that I haven’t considered before, but are now part of my reality. Spirituality has given me the opportunity to be my own therapist, it has given me the ability to be here when I want to, it allows me to forgive myself, and others. But, again, I also gained the ability to realize all the moments I wasn’t there, I didn’t forgive, I hurt myself. If I’d take the drugs, I wouldn’t have had this journey. I would, possibly, still be angry about myself, how stupid I am to do certain things, probably still be that person I was back then, in a more evolved form. But I didn’t go that way. Luck? Awareness? Stupidity? Who knows. It’s just not part of what I am today.
What I also learned from all of this is why certain things in my life are just the way they are. I always enjoyed fast, mostly aggressive, electronic music. I also enjoyed an unhealthy amount of skate punk in my early 20’s. The bestest band of all time still is Millencolin1. I think my body reacts to this music, and therefore I, in my brain, enjoy this music too. Fast rhythms, that sort of thing turns me on. This also goes in line with the opinion that our nervous system is part of our intelligence. Most humans think of intelligence as something that is in our head2. But we are human. Our body is part of us. Our body is intelligent on its own, we just don’t “think” of things it does actively. There’s an entire “thing” attached to our head that does amazing things, and we don’t think it’s contributing to our whole-self being. Mind and body are the same thing.
I enjoy working fast, too. I couldn’t do it all the time though, if I wouldn’t take regular breaks. I’d burn out too quickly. My body is human after all. Though my body has a special ability to have a higher energy level, that doesn’t mean I can use my body “more”. I’d use up my body, I’d hurt myself.
Sport. I started working out about 10 years ago when I moved out of my parent’s house and into my own room, to study in Munich. First at home, to keep balance from sitting so much. It quickly evolved into riding my bike and going to the gym, where I learned running. When I started, I realized soon that I want this to become part of my life. It felt good. Now 10 years after, it has become part of my life. I read many books and articles on fitness, muscles, the nervous system, etc.. A trainer once told me at a gym I was back in 2006 (already in Stuttgart) that many people who go to the gym, get a certain workout plan, and then just stick with it until they cancel their membership. He said that a new workout plan should be made about every 3 months. So I began working with my various trainers every 3 months to alternate the route I was taking. In my current gym, member since 2011, my trainer and I recently had a discussion where he said: “Why do you even come to me anymore? You know all this stuff pretty darn well. Even if you don’t, then you can just ask any random trainer in this studio. We shouldn’t meet to discuss what exercises you do, maybe, really maybe, the route you take. The rest you can do by yourself.” I thought about it and he was right. I can do this by myself. I got into calisthenics/functional training in 2010, back then it didn’t have a fancy name (or even an entire industry behind it). I remembered that time and thought, let’s cancel my gym membership for a month and see how well I do on my own, with no equipment at all. It was a great month, but I missed going somewhere to do my exercises. I am now back in the gym, mixing calisthenics with weight training. I will continue going by bike or by foot anywhere I can, I will continue running once weekly.
Ten years ago I was a different person. Who would have known I’d become this? I never thought I would, but here I am.
If you have any questions on hyperactivity, exercising, relaxation, meditation, anything mentioned here, feel free to ask in the comments or catch me on Twitter.
Movist is nice. It not only supports everything QuickTime and FFmpeg plays, but also what both support. What I mean by that, if you have a video file open, you can re-open it again with the other decoding engine. Just choose Reopen with … from the File menu.
OS X Mavericks added some features to “labels”. Previously files and folders were only able to have a color label, now these labels can also have tags. Color labels are now essentially tags with a certain name which also can have a color.
Mavericks also adds the ability to Sort by Tags from every window. This means we can (ab)use this feature to get custom sorting for files.
I have a folder called Watch Later, especially useful when traveling. Let’s be honest, when you go on a travel, you put every single possible movie you may want to watch on your disk so that you can watch everything offline, because when will you have a decent enough connection to watch, right?
The key here is: what priority do you give to watching movies?
Set up some tags 1, 2, and 3, then choose Tags from the Arrange By menu.
Here’s a promising repository for you to watch. A guy by the name of MaddTheSane has been working on Perian. The last commits are only a couple of days old. Maybe we’re going to see an updated version of Perian coming out soon? That would be great!
Lifehacker compares prices of various goods on Amazon and supermarkets. The result is not hugely different from what you might expect. What Lifehacker is totally missing here is valuing time and travel time saved against an item’s actual price. I’m sure that the calculation would be very different then.
A couple of weeks ago a befriended developer sent me a beta app and asked that I take a look at it. The app is called Think About It by Bone Desert Software Limited, a decision assistant, which is now publicly available.
I now have three apps on my device(s) to help me make decisions. Sometimes I’m torn between two options for something easy like “do I go to the gym today or tomorrow?” These kind of decisions have no effect on my life, because it doesn’t matter if I go today or tomorrow, all it matters is that I go. Decide Now! helps in this instance.
I also have Decision App, which is handy for more elaborate decisions. The app has some of the most useful decision matrices included. The only downside here is that the app doesn’t really improve the decision making process.
This is where Think About It comes in. TAI allows you to create a Decision and add Criteria that must be met to determine the most suitable solution. Rating these Criteria allows the app to calculate a result automatically. Criteria can be something measurable, like the price of an app, or something less defined like personal preference or a feeling.
Once multiple Criteria have been created, a new option shows up: “How important is this?” Here a user can rate the importance between Criteria. For instance, in the example of a decision whether to buy an app or a competing one, price may be more important than UI design. Think About It reports any inconsistent rating. These inconsistencies have to be resolved before Think About It is able to make a choice. The app also assists in the process of highlighting where the inconsistency is likely to be.
When all Criteria have been added, it is time to add Choices. Choices are basically the alternative outcomes you are considering. In the above example, the iPhone apps themselves. The last step is to measure how well a choice performs against the other choices for each Criteria. When everything is entered, the app will present a calculated, unemotional, winning result based on true facts.
You need to create an app on Pushover for this. Don’t forget to assign user and API key in the Shell script action, then you’re good to go.
I left the other URL parameters in the script so that you can see what other options you have on Pushover.
Obviously there had to be a better way, right? Right? Oh was I wrong. Read the comments (from 2006!) and have a good laugh. I don’t know about you, but when I name my files I just don’t give a fuck.
The general rule is simple: as long as the system supports certain characters, I see no reason to avoid certain characters.
I spend quite some time working with editors and designers. I giggle the first time I see design_1.psd popping up in Growl. I set some time aside for these folks and explain the advantages, but also the disadvantages of such file naming conventions. I explain that they can use whatever they feel like, because the computers we use have Unicode. As long as it’s useful there’s no reason to castrate file names in an unreadable manner.
Heck, I even use Emoji’s for filenames sometimes, just because I feel like it and I know that I can. And so should you.
Keyboard Maestro Macro: Arrange windows next to each other
I made a new macro for my Window macros. This one arranges two windows on screen so they are right next to each other. This is nice when moving files from one folder to the next or to compare two folder contents.
It also allows you to have a custom window distance. If you prefer to have 10px between the windows, simply put 10 in the first Set Variable action.
How this macro works:
Execute macro. This will save the foreground window’s title in a variable.
Bring window you want to arrange it to to the foreground. This will save this window’s title in a variable.
Both windows will be moved to the middle of screen, some px apart. First window will be left, second window will be right.
By now it should be no news that LinkedIn has released a very controversial new product called Intro.
What Intro does is probably known to the readers here. You should be technically savvy enough to know this kind of stuff. If not, please go ahead and read Bishop Fox’ “LinkedIn ‘Intro’duces Insecurity”. Since last week I’m spotting some tweets by folks I follow, including Craig Hockenberry, who are asking for which servers to block in order for them not to, unintentionally, communicate with Intro users.
FreeMind was the app that brought me to digital mind mapping. Back when I was studying and didn’t have any money this was the best app to get. It has been in beta for years, literally. Over the most recent weeks releases have indicated that 1.0 was nearing.
I still recommend FreeMind to new mind mappers. It is free and it has quite a lot of features. Including many of those that people want from Mac-native apps like MindNode and others, including comments and icons for nodes.
I’d recommend to give FreeMind 1.0 a whirl again and to keep using it if you are fine with running a Java app.
Cocktail has just been updated with Mavericks compatibility. I’m not a huge advocate of OS X “cleaning” and “repairing”, but Cocktail is one of the more useful ones - and it has a great licensing model.
My most used features are quickly delete the Spotlight index, reset various OS X databases like Launch Services, and its feature to delete .DS_Store files from a tree of folders.
You may have realized by now that this blog has become very quiet. Normally when this happens it means that people are really really busy. I’m really really busy right now. I’m not reading that much, I’m not on Twitter that much… essentially “new stuff” doesn’t reach me as quick, and if it does, I don’t have enough time to post it here. That’s what it boils down to. I have experimented posting two posts a day, using Tumblr’s auto-post feature for the Queue, but now that I don’t have so much time anymore, this blog stays calm mainly, due to me not being able to refill the queue. I had it set to post one post a day almost ever since I’m running this blog, and I’ll switch it back to 1 post a day.
This is just to let you know that I’m not dead, I’m just working on things that need a lot of my attention and energy. I appreciate everyone who is reading this blog. You humans are great!
I hope to be back on track with this blog soon-ish. For the time being, I’ll post as much as I can, but don’t expect anything extraordinary.
OS X Tip: Execute Java Apps like Minecraft or jDownloader with 64 bit Java 7
Minecraft and other Java apps have the problem that they launch in Java 6 by default. If you are on Mavericks, you will not even have Java 6 anymore. Even though you launch these apps an OS X dialog will ask you to install and use Java 6, instead of the newer Java 7.
The solution is actually pretty simple. Instead of executing these apps using their .app Java launcher, you can execute their .jar directly and OS X will use Java 7.
Head over to Oracle’s website and download Java 7 first and run the installer.1 This will install Java 7 in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin.
Right click and choose Show Package Contents.
Go into Contents → Resources → app.
Double click jDownloader.jar
Minecraft (or Feed the Beast):
Minecraft is a bit more trickier. First you have to install a newer version of lwjgl.
Right click and choose Show Package Contents.
Go into Contents → Resources → Java.
Double click Bootstrap.jar
Just double click FTB_Launcher.jar
You can always check whether something is being executed 64 or 32 bit in Activity Monitor. Just make it show the “kind” column from View.
A couple of weeks ago I started watching one of my favorite TV series of all times: One Piece. As you know I’m working on zCasting 3000 now. I want to figure out what that company stands for. What kind of place is that going to be like? I recalled One Piece that I used to watch when I was 17 or so. What I liked about One Piece was not just the story, but the way the main character, Monkey D. Luffy, approaches his goal of becoming the king of pirates.
A repeating pattern in this series is that people keep telling the not-yet king of pirates that reaching his goal is impossible, out of reach, that he should stop trying. As you can imagine from an anime, the way this is displayed, is very repetitive1.
His only reaction to well meant advice and expressed doubts like this, at least in the early episodes, is: he just stands there smiling, laughing, and then saying “we’ll see when I get there.”
He emanates a certain calmness. He’s young and appears to be a kid just having a crazy idea, an idea not very well thought through. But it is actually the opposite, he has thought about his career choice very well and he is aware that he has to kick everybody’s butt if he wants to become king of pirates.
"If you don’t want the negative reputation, you shouldn’t be a pirate" ~ Monkey D. Luffy
Of course this is all idealistic and it’s just a TV show, but why not be idealistic about personal goals? Rather than being stuck in the current, one can also just live as if the goal was reached already.
And that’s why I’m a fan of Monkey. Not just because of that. There are other “values” this show holds high that I can identify myself with too. But it’s one of my main reasons.
Omni is updating most of their apps big time at the moment. Their decision to release all new apps as new apps without upgrade pricing and also removing all older versions from the Stores has sparked quite some discussion. Many people are upset and disappointed. I was one of them, and still am, albeit not for every product in their line anymore. Let me explain.
The problem people face is that Omni is not updating one or two apps, but instead we see a new major release for an app every week. This means that the amount of money we would have to pay to Omni is incredibly high (of course no one is forced to upgrade).
I bought OmniFocus for iPhone right after it came out. I bought many more apps from Omni. I am using: OmniFocus, OmniPlan, and OmniGraffle. I was asking myself how much are these updates really worth? Is there a reason to be upset? Can there be something behind all of this that would make a purchase justifiable?
Here are some numbers and calculations that I did. Most of this boils down to depreciation. I’m including release dates for all versions of an app, for completeness, though I’m only writing about OmniFocus for iPhone, OmniPlan for iPad and OmniGraffle for Mac. Relevant numbers are italic.
iPhone = 15th October 20091
iPad = 30th July 2010
Mac = 8th January 2008
Date of Purchase
iPhone = 12th November 2009
iPad = 17th december 20112
Mac = 13th december 2009
iPhone = 18€
iPad = 36€
Mac = 60€
Price at Time of Purchase
iPhone = 16€
iPad = 32€
Mac = 60€
Value Over Time
The iPhone version came out 48 months ago, at its current price this means that the app costs 0.375€/month.
Taking into account the time when I bought it and OmniFocus’ price back then, the cost is down to 0.3404€/month.
iPad = 16th May 2012
Mac = 8th May 2008
Date of Purchase
iPad = 22nd April 2013
Mac = 17th December 2011
Current Price (price hasn’t changed)
iPad = 45€
Mac = 150€
Value Over Time
I’ve been using the iPad version for 5 months, but it’s been out for 17. So my version costs 9€/month, where users who bought at release day are using it at a value of 2.6471€/month.
The time I could appreciate the app was very short, therefore upgrading is bitter. (more on that later)
iPad = 2nd April 2010 Mac = 5th March 2008
Date of Purchase
iPad = 15th April 2013 Mac = 17th December 2011
Current Price (price hasn’t changed)
iPad = 45€ Mac = 80€
Value Over Time
OmniGraffle has come out about 5 years ago, after such a long time I think it’s more than understandable that a new version is on the horizon. I’ve been using the Mac version for 23 months. This brings its value to 3.4783€/month. Get-go users paid 1.194€/month.
Value Over Time Summary
By looking at the numbers it becomes clear that the “value” over time makes new major versions of these apps justifiable.
Some numbers indicate a tighter release schedule. Just perceived or real, OmniPlan has been out 17 months before it received a new major release, OmniGraffle a whopping 67. OmniGraffle users got a lot more bang for the buck, if you will. OmniFocus for iPhone users got to use their app for 48 months. Not too bad.
I think the main problem customers have is that their old app just disappears from the store. “Customers hate the current method of paid ‘upgrades.’” - marco.org.
Despite the fact that a new version of OS X and iOS will come out/has come out and a developers’ job is to look good in the store. What would have been Omni’s options? Not bringing out a new version of an app, consider the huge changes to the operating system, would mean their competitors get an advantage.
I contacted Omni in regards to my problem. They offered a very (very) generous refund. That means I’ll be able to use OmniPlan 2 for iPad very (very) soon! Thank you, Omni.
Fun fact: I bought the iPhone version, before I even had an iPhone. ↩