3 Comments »

In my last post, I discussed how you can use AutoHotkey and SlickRun to quickly display useful text information. Although I’ve been using that technique for months to show me my credit card number, and often-called phone numbers, I recently decided that I wanted to do more. Specifically, I wanted to be able to quickly see a yearly calendar. You know, you’re thinking about something, and suddenly need to know exactly what day the 5th of October is?

My normal technique is to simply minimize everything on my desktop (Win + M key) to see my desktop background. That’s because I’ve got tiny calendars of the next three months sitting there, courtesy of Samurize (see my posts on my desktop for more details). But, really, that’s a pain to do. So I said to myself, why not a popup box with a calendar? And heck, go big, show the whole year at once!

So, using the Cygwin “cal” command, I created a text file, called year.txt, that contains the 2007 year in text. I’m including it here, in case you want to use it, but don’t have Cygwin installed.

Then, using the technique discussed previously, I set up an AutoHotkey script to read the file, and a SlickRun magic word to launch it with a couple of key strokes.

Unfortunately, when I use a message box with calendar information, the default proportional font looks absolutely awful. Unreadable really.

Changing Windows Default Font for Message Boxes

So, I decided to try switching the Windows default font for text boxes. You can get to this from the Control Panel’s “Display Properties”. Go to the Appearance tab, and then select the “Advanced” button. You want to change the Font value for the “Message Box” Item. I’m a big fan of Bitstream Vera Sans Mono. Here’s what your dialog would look like. You can pick any fixed-font for the font. Even if you’ve never installed any extra fonts on your machine, you could use Courier New.

Click OK, and then Apply on the Display Properties window. Now, all message boxes will use this fixed font. I figured that for how often I see a message box, it wouldn’t bug me too much to see a fixed-width font there.

Look at How Pretty It Is

Here is what my yearly calendar looks like now, using the Bitstream Vera Sans Mono font:

Isn’t that pretty? What a clever little solution I found. How easy was that?

Ugly Side Effect

Was I ever surprised when I looked at my FireFox next! Most of the fonts in the FireFox application seem to be based on the same font that the Windows message boxes use. Not the guts of a web page, but things like the address bar, search bar, bookmarks bar, tabs, and status bar. It looked bizarre, to say the least.

Here’s what FireFox used to look like:

And now here’s what it looks like:

I didn’t mind so much on the status bar, but I found the effect really distracting on the tabs, and even in the Extensions list.

Fixing FireFox Fonts

Given how much customization people do with their FireFoxes, I figured there had to be a way to fix this. And there is. You do have to modify your userChrome.css file, which actually isn’t as scary as it sounds.

One of the best sites I found discussing the userChrome.css file was here. The author tells you how to find the file if it already exists (and it might, if you’ve done some other customizations), or how to create it with a text editor. He’s also got several things to stick in there to make other changes to your FireFox.

However, I just used that page to make sure I was editing my file properly. The change that you want to make, to “undo” the font problems caused by changing the Windows default font for message boxes, is as follows:

You want to add the following code to your userChrome.css file:

/* Set font size and family for dialogs
* and other miscellaneous text
* http://www.mozilla.org/unix/customizing.html#usercss
*/

window, tooltip {
font-family: ‘Microsoft Sans Serif’ !important
}

I got the idea from the Mozilla.org Customizing Mozilla page. The example they have their changes the font of everything to Helvetica, with a size of 3.5. I didn’t want that (although you might); I just wanted to change it back to the default font, which is ‘Microsoft Sans Serif’. (Don’t forget the single quotes!)

So, add that little snippet to your userChrome.css file. Save the file. Close FF and reopen it. Now, your FireFox should look right, and you can still have nicely fixed font message boxes.

The example from the Mozilla page didn’t completely fix FireFox though - tooltips were still showing with the fixed font.

So, based on an example from here, I added in the “tooltip” to the code above. That fixed the tooltips, and “window” seems to take care of the rest. There’s probably something else I’ll need to fix, but I’ll just have to keep plugging away at it :)

Update [6 Aug 07]: Instead of using a fancy font like Bitstream Vera Sans Mono, you might be better off using one of the standard fonts that come with Windows, like Courier New. Although I love the look of the Bitstream Vera Sans Mono, I noticed that I was having trouble with other applications. For instance, my SnagIt window couldn’t show some of its menu choices. No idea why, but switching to Courier New fixed that. There may be other things that look hinky. Personally, I’m willing to take a bit of hinky to get the year calendar available with a couple of keystrokes. Your mileage may vary :)

4 Comments »

Do you ever wish there was a way to quickly see some information, without having to navigate to some other application? I’ve found that there are several types of information that I want at my fingertips over and over again. Things like my credit card number, or a list of frequently called phone numbers.

If you’re already using AutoHotkey, you can easily get it to spit out a message box for you, with the requisite information. And, if you’re using SlickRun, or some other quick launching application, you can do it with a couple of key strokes.

Example Message Box (Little Info)

Let’s say you want quick access to your credit card number. Here’s an AutoHotkey script that you can use to spit it back at you:

msgbox, 32, Credit Card, Number: 1234 5678 9012 3456

Simply copy that text and stick it into a text editor. Name the file CreditCard.ahk. Now, when you double-click on that ahk file, you’ll see a message box like this:

If you wanted to, you could stick a whole bunch of info in the one msgbox line. You can use `n (that’s the left single quote followed by n) to indicate where you want a carriage return.

Example Message Box (Big Info)

Alternatively, maybe you want to output a bit more information, and don’t want to have to mess with using `n to indicate carriage returns. It’s also possible to get AutoHotkey to read a text file, and output its contents as a message box.

Let’s take a little text file (say, phone.txt) with a few phone numbers in it:

Doctor (123) 456-7890
Hairdresser (345) 234-2324
Fabio (123) 343-2343

Now, this script:

FileRead, lines, f:\todo\bin\testphone.txt
msgbox, Phone Numbers, %lines%

which you could save as PhoneNumbers.ahk, will read in the phone.txt file and output the contents like this:

Adding SlickRun Goodness

Okay, so far we have great output, but we still have to find the ahk files in the first place, in order to run them. Here’s where SlickRun comes in. (Or whatever other fast launching application you like). Simply create a magic word in SlickRun that runs the ahk file. For instance:

So now, when I want to get my phone numbers fast, I just type the key combination that brings up my SlickRun, then start typing “phonenumbers”. After a few letters, it’s the only option, so I hit enter. Then, up comes my message box with the desired information.

3 Comments »

One of the posts that keeps coming up in comments and email is the one I wrote about using the FOR command to rename files from the command line. I just got another request about it that intrigued me: how can you rename files that have spaces in them? It’s not just that you want to slap the file name in quotes; you want to actually extract part of the filename to reuse in the new filename. Hmmm.

After a bit of searching, and experimenting, I have it.

The Problem

The first thing I like to do is create a directory with a few empty files in it, named appropriately. In this case, I have:

Directory of F:\ToDo\test
Sun 10 Jun 07 11:19 <DIR> .
Sun 10 Jun 07 11:19 <DIR> ..
Sun 10 Jun 07 11:19 0 abc xxx 123.txt
Sun 10 Jun 07 11:19 0 abc xxx 456.txt
2 File(s) 0 bytes

The request is to rename the file “abc xxx 123.txt” to “123.txt”.

Testing Your Expression

Looking at it, it doesn’t seem too bad, but the way I’ve explained it in the original post won’t work. That’s because there, I have one delimiter, “.”, which will end up breaking the file name into two chunks: “abc xxx 123″ and “txt”. That doesn’t quite help. I need to break it into more chunks.

So, I did some searching and testing, and have come up with a way to break the file name into four chunks. One thing I do is run a non-destructive test, to see how my expression works. If you use the FOR command with a benign “do” section, like “echo”, then you can see how the filenames in your directory are broken up.

For instance, I’ve come up with the command:

for /f “tokens=1,2,3,4 delims=. ” %i in (’dir abc*.txt /b’) do echo %i-%j-%k-%l

Here, I want to break each file name into four parts, using the “.” and ” ” as delimiters. The stuff in the brackets is telling the for command what to read though; in this case, a bare directory listing, filtered on text files that begin with “abc”. I could have just done ‘dir *.* /b’ in here, but I didn’t want to mess up another other files. You can see my original post for more information about the FOR command.

At the end of the command, you can see my non-destructive test - simply echoing the four parts of the file name, with a hyphen in between in each. The results of this command are:

As you can see, this command breaks up the filenames perfectly.

The Solution

Now that I know that my tokens are being broken up properly, I can run the actually renaming command. In this case, the filename “abc xxx 123.txt” should be renamed to “abc.txt”. This command will do it for you:

for /f “tokens=1,2,3,4 delims=. ” %i in (’dir abc*.txt /b’) do rename “%i %j %k.%l” “%k.%l”

And here are the results:

And that’s all there is to it. It never ceases to amaze me how powerful using the FOR command is. If you play around with it, you can figure out all sorts of interesting things :)

4 Comments »

Some time ago, I discovered that I didn’t really have a projects list. So, I decided to do something about it. I did some searching to see what other people did with their projects lists, and then came up with my own solution. Basically, I kept a “list” in MindManager, divided by kind of project. Then, in the weekly review, I would make sure that every project had an NA, and every NA had a project. Or something like that. I also included EverNote, as that’s where my project support materials live.

Well, that kind of manual checking, editing, tweaking, changing, etc. lasted for exactly two weekly reviews. No go. Manually checking to make sure that every project has an NA - ugh. And for every project NA in my todo.txt file, make sure that there’s a project in the mind map, and in EN? Double ugh. There had to be a better way to do it.

Unfortunately, in my searches, I haven’t found many programs that would let me do my NAs the way I want, and keep track of my projects, the way I want. I think that something like Tracks would come closest, but even then, there are things missing, for me. What to do? Well, I’m obviously loath to give up my Perl/DOS todo.txt scripting goodness, so was there a way to make this system work with projects?

Turns out that there was. It took a few hours of coding, spread out over a few weeks, but I now have a project list management system that I’m really pleased with. It works beautifully in the weekly reviews, which is when I need it most.

Background

I keep my next actions in a text file, called todo.txt. Some of these next actions have projects assigned to them, e.g., [Blog] Blog about blah…, where [Blog] is the project name. Some of the requirements that I had for a project list management system were the following:

  • It had to be easy to add and delete projects from the list.
  • It had to allow me to have different types of projects, e.g., “now”, “later”, “deferred”, “waiting”, “someday”, and “recurring”.
  • It had to allow me to easily move a project from one category to another.
  • It had to link with my next actions, automatically. Specifically, I wanted to be able to retrieve the following information easily:
  • Which of my “now” projects didn’t have any NAs assigned?
  • Were my “waiting” projects really still waiting?
  • What were the NAs for a specific project?
  • A list of all projects, divided by category.
  • A list of all projects that had absolutely no NAs assigned?
  • Similarly, a list of NAs in my todo.txt that had projects, but the projects were missing from the project list.
  • For “deferred” or “waiting” projects, I wanted to know what the trigger was, i.e., why was a project deferred (basically - unstartable) or what was I waiting for. I had to be able to add or change these triggers easily.
  • I had to enjoy using it. I wanted to be able to do all of these things from the command line, with pretty output, and without having to go into the actual text file with an editor.
  • The System

    All I did, basically, was create a new text file, called projects.txt. Each line in this file is a project. Each line looks something like this:

    [#Reading] now

    where the term in square brackets is the project name (no spaces please) and the next term is the type of project. I also have more complicated lines, such as:

    [Aeroplan] deferred trigger(next statement)

    where the trigger() just tells me what’s causing the project to be in deferred or waiting mode. Note that I use deferred for projects that I don’t want to start yet, or that need a particular occurrence to happen first. I use waiting for projects for which I’m actually waiting for input from someone else.

    After creating the text file, I just started messing with my todo.pl Perl script, adding in subroutines to deal with the projects.txt file. Simple things like adding a new project, or even changing the type of a project were pretty easy. It got more complicated when I got into things like outputting a certain type of project, along with a count of the different kinds of next actions (e.g., doable now, not startable yet, waiting for, etc.) I really enjoyed coding all this functionality, more than I enjoyed the initial coding that gave me the todo.pl in the first place. Part of the fun was discovering Perl’s printf statement, which can be used to output text in columnar fashion - very cool, and you’ll see how I put this new knowledge to good use.

    ScreenShots

    Now to show you what my new baby can do!

    Projects Command

    The “projects” command shows me all of my projects, divided by type. I used the printf statement to get the columns so nice. I did have to set it up so that longer project names are truncated, but that’s okay - it was more important to see everything in one row. The purpose of the Unknown column is to simply keep track of any project in my list that hasn’t been assigned a proper type. I’ve also got counts of how many projects of each type.

    Showall Command

    The “showall” command shows me all of the projects, of a particular type, with counts of the different kinds of next actions for each project. An NA is considered a “now” if it is doable right now. It is a “wait” if its context is @waiting. It is a “defer” if it can’t be started before a certain date, some time in the future. Finally, it is a “someday” if it’s been marked @someday. The purpose of this output is to show me, at a glance, that all of my “now” projects have a “now” next action, i.e., each project has something that I can do, right now, to move it along. All I have to do is look for zeroes in the “now” column.

    Show Command

    Sometimes I want more detail for a specific project. The “show” command does just that for me. First it shows me a count of each kind of NA for that project, then it lists out the next actions in all their detail. You’ll notice a bit of a goof here though - my “defer” count is 1, even though two of my NAs are actually startable. Obviously I have a tiny logic error somewhere. It’s not major, but I’ll make a note to fix that bad boy later.

    Review Command

    The purpose of the “review” command is to compare the projects that I have in my official projects list, with those that are read off the next actions in my todo.txt file. It’s possible for me to add a next action, with a project assigned, but to not have that project in the official list. This often when I start off on a new tangent. It’s also possible, actually highly likely, to have projects in my official list, that don’t have any next actions assigned. For example, I might have something like “Learn to Fly” as a @someday/maybe project, but there’s not going to be anything in the NA list for it. Similarly, I have certain projects, that keep coming back over and over, but they don’t always have next actions currently. One example might be something like TweakComputer or Backup.

    So, here I can see which projects are in one list, but not the other. The goal is two-fold: (1) there should be nothing listed in the left column; (2) there should be no “now” projects listed in the right column.

    Conclusion

    I’m not going to release another general purpose exe file, like I did the first time around. I don’t think there’s any demand for it. Instead, anyone with Perl chops can email me, and I’ll send you my script. You can take what you like from it. For the rest of you, I just wanted to show you what I think a good project list management system could look like. If there are any tools (on- or off-line) that can do this kind of thing, while also keeping track of next actions, contexts, deadlines, etc., please let me know in the comments. Maybe there’s more out there to play with :)

    No Comments »

    Before I can continue with my Super-Duper Personalized Productivity Desktop background series (see intro and stack), I need to introduce you to the software required to get your text-based calendar onto your desktop background.

    First, for you folks that are living in Windows, you need to make the acquaintance of Cygwin. Cygwin is described as a UNIX-like environment for Windows, which basically means that it lets you do things in Windows that Mac users, UNIX users, and Linux users can already do.

    Then, armed with Cygwin, you can make use of the Remind application. Funnily enough, even though “remind” is a very common word, if you google “remind”, the first hit you get is what we’re actually talking about, i.e., the Remind open source product over at Roaring Penguin. Remind is “a sophisticated calendar and alarm program”. I’ve only started scratching the surface of what I can do with Remind combined with Cygwin, but it’s actually enabled me to stop using Outlook for my calendar. I don’t want to get anyone too excited though; working with Remind is not for the faint of heart. However, if you’re into geeking and into text files then you too can have your calendar showing up on your desktop with Samurize, just like in this picture.

    The Remind Calendar - Where to Find Help

    Instead of trying to explain Remind to you, I’m going to point you to the sites that I went to when I was learning about it. Suffice it to say that you start with a text file, a certain syntax to describe appointments, due dates, etc., and Cygwin to run it all on a Windows machine. These sites are great, and when I have questions, I go back to them.

    • The “purest” information about remind will come from its man pages. To get to this “manual”, at the cygwin prompt, simply type “man remind”. Or, you can look at this pretty html version, available at the Roaring Penguin.
  • Geek to Live: Keep Your Calendar in Plain Text with Remind (LifeHacker)
    • A seminal post; more enthusiasm for text files and remind, and this time from a Windows perspective. This will be the best place for Windows folks to start.
  • Guest: Mike Harris looks at “Remind” (43Folders)
    • I think this was actually where I got my first look at Remind. Anything that Merlin Mann does has got to be eminently cool and “tryable“.
  • 43Folders Remind Wiki Entry
    • Another great resource, includes script snippets, use cases, helper utilities, etc.
  • Remind: The Ultimate Personal Calendar (Linux Journal)
  • Manage your time with Remind (Linux.com)
  • These last two I include for the sake of completeness. I’ve spent quite a lot of time searching online for more information, examples, etc. for Remind. Unfortunately, there doesn’t seem to be all that much. The posts I’ve linked to above are it. If you have any other links to online Remind resources, please let me know; I’d like to update my library.