TextMate theme-switcher script

10/09/2008
Summary: In which Martin ponders solutions on how to quickly switch themes in TextMate and comes up with a half-assed AppleScript / TM Command solution. Jump to the half-assed solution.

Edit: As these things usually go I had a bit of a revelation just minutes after posting this post. Completely by accident I typed the keystroke ⇧-⌃-⌥-T, which of course is mapped to the “Select Theme” – command in the Experimental Bundle and which I had completely and utterly purged from my mind. I’m pretty sure you want to use that solution rather than the one I outline in this post, but I’ll keep this around for posterity’s sake anyway. Original post follows.


I’m about to start teaching a 5 week class in ActionScript 3 and if there’s any possible way to avoid it, I won’t spend much time in the IDE code editor, because frankly; It sucks. So in order to make the differences between what the students will see on the screen (You guessed it. TextMate.) and what they’ll be working in themselves, at least initially, I played around with one of the themes in TextMate to make it look more like the Flash IDE editor.

From my beloved Twilight theme:
Tm Theme Twilight

To this IDE clone based on IDLE:
Tm Theme Idle

So since I’ll keep using my main theme for all my professional work I wanted a fast way of switching between the two themes (I’ll do a lot of work to save myself from dealing with a drop down menu). A bit of googling (actually a fair bit of googling) turned up this gem from a spanish speaking TextMate google group. Now, before you even start; Yes I feel slightly dirty about GUI-scripting as well. Making a script that simulates clicks rather than one that just tells the OS to perform whatever task associated with said click just feels wrong. But since not even a journeyman when it comes to the arcane arts of programming TextMate I’m just going to bite the bullet until someone (you?) comes up with a better solution.

Read the rest of this article »

1 Comment

iPoem

16/08/2008

Perpetrating some hackery on my iPhone I stumbled over my custom generated dictionary file. I found a odd sort of pleasure in the fragmented and / or randomly constructed phrases it contained. Since I’ve nothing else to contribute with today, I’ll share it with you. No I have not been drinking.


but feels so damn sluggish dear god yes let’s just hope will be out soon and will be painless for unlocked phones things that gather windows show hide remove files rename all files in folder saturday night slightly just by breathing air wondering i’ll to for using because this is some black magic shit then remembered don’t believe in haha time for some to see that of the visitors my mainly tech and web related use what the are four people thinking oh wait tell lie only guess my mom and dad and their dog then the dog only counts as tenth of person since it passed and over iphone apps being useless input feeds tv books where’s the time to think safe as in the easily the best mouse ever for those tasks just can’t find course plo fine my secret trick slamming my genitals on the desk scream am fear me and just in itunes plo caution however you’ll lose and jailbreak apps totally worth it to me since they’ll be out soon anyway hear one more word about i’m going to scream and will so shall bin it how clipping test this is stupid her okay first smoke today i’m quitting first smoke today i’m quitting temperate really naturally spent two hours making the to get work done for for my blog fail sure but as you average computer user user i’d expect it to heavily slanted away from oslo fire it feels sad the first time your don’t recognize grandparents didn’t recognize me me for the first time no joke i’d love for this to work nicely although wish would come with an iphone app soon just isn’t what i’m after test for text recognize bin test venter can’t edit but can depressed all were it’s too early for to think of anything witty to say just pretend that whatever says next was really said me html plo several methods none of them optimal i’m using these days and it’s not too shabby waste so far this day has failed to amaze and dazzle with it’s awesomeness something extraordinary better happen soon on the bus test bin does the dictionary suck here as well seems it’s good anyway still have problems loving this app maybe it’ll improve sure hope so what is this bullshit fix it cheers found it then promptly lost interest thanks anyway create iphone flex du i’m i’m talking about flash dag was better at object oriented programming illustration singing climbing cooking sex the last once upon time web professional was supposed to know both design and programming is there place for this middleman anymore worries may not cut as programming in this context even alex book as list tasks make i’m confused import flash display but only use some of the in my code does or just plo ring agree but it’s nice to know clients don’t suffer when up if this but see my update after umpteen secs plo agreed just good to know clients don’t for my men now that we’ve got to know each other and do hope think too forward but please what are your feelings feelings regarding you don’t right now at this well i’ve better and i’ve felt worse suppose i’m happy and lift in the wee hours better catch some deadline day is my favorite joke perversely last minute up up and away on bike what kind of up place do you work oh right get drunk instead den money for beer ashamed wish hadn’t wished wished money for beer wish wished had money and secretly spent it on beer nmr nmr ok i’ll bite what’s trying set up compile           and be on saturday   bowdlerized ipsum gidder opp blir z’s misc hadde ikke tenkt typen ser textmate swf’s fuck lazyness meh i’ikke  nme   yojimbo dder opp blir z’s misc hadde ikke tenkt typen ser   ikke nme  yojimbo mbo e  yojimbo  ikke yojimbo o bo tive   hotkey yojimbo mbo bo imbo


That is all.

1 Comment

OmniFocus clippings from Firefox

1/08/2008
Summary: In which Martin has created an AppleScript to remedy Firefox’ poor support for OmniFocus‘ “Send to inbox” hotkey. This is a lengthy post with lots of dreary explanations, so you might want to jump to the finished script if you don’t care about how stuff works.

Edit: An alternative version brings up your Quick-add dialog and populates it. Check this comment if that sounds more appealing.

Fire Omni Quick

To get this to work you’ll need Quicksilver. But you’ve got that haven’t you? Sure you do.

I’m trying out OmniFocus nowadays for my obsessive-but-not-GTD-level organizing needs. It’s still a tad overkill for what I need, but they have the best iPhone sync so far, and I assume I’ll just be assimilated into the cult of David Allen sooner or later so what the hell.

One of the things I like about OmniFocus is the “Create Clipping” functionality. OmniFocus allows you to at a keystroke (♥) send whatever text is currently selected to your Inbox as a clipping.
However this isn’t working in Firefox 3. Mozilla practically stripped all the scripting abilities in v2 and i suppose that’s what goes for a “feature” nowadays. This needs some serious fixing. Let’s get our hands not-really-dirty-but-maybe-a-bit-smudged.

Edit: I’ve updated the script with a new version that also grabs the URL of the clippings origin.

Read the rest of this article »

6 Comments

Hotkeys galore: QuicKeys

1/07/2008

As mentioned before: Mouse bad, Keyboard good. Back when I thought I was going to be a designer and spend my life in Photoshop and Illustrator I still was a huge fan of keyboard shortcuts. Difference is that since the mouse was, by necessity, my weapon of choice in those days and my love for hotkeys was limited to those found within the apps themselves. Nowadays I spend most of my screentime working in TextMate and don’t reach for the mouse unless I have to.

In my ongoing rant about killer keystrokes I’m gonna turn to an app I found while trying to solve a particular conundrum.
The story goes like this: After a long time of using my laptop keyboard I’d gotten used to having my Exposé keys be the four rightmost F-keys. F9 through F12 on a MacBook Pro. When I got an external keyboard Apple had graciously endowed me with seven more F-keys, up to a grand total of 19. Ever the autist, the thought of reprogramming my muscle memory to slamming down at a new location seemed too much of a chore. However, I couldn’t just remap Exposé to F16 through F19, because then I’d be stranded when I used my laptop without the external keyboard.

I tried several solutions, starting of course with searching iUseThis where somehow I didn’t find this particular app at the time. I lurked around several AppleScript fora and found some solutions that was just too damn dirty to be acceptable. Finally I found QuicKeys.

My solution? Remap F16 through F19 to fire off F9 through F12. This may still seem a bit dirty. After all, now I have a duplicate set of Exposé keys, but think about it; My brain is hardwired to use F9 – F12 for Exposé so I’ll really never be able to use them for anything else. Furthermore I only ever use F16 – F19 when my external keyboard is attached, so they’re doing exactly what I want. Enough of the dreary backstory. Let’s have a look at QuicKeys.

Read the rest of this article »

3 Comments

Firebug hotkey fix

30/06/2008

I might be the only one with this problem, but in case that isn’t true I thought I’d write up a short one.

I love (Nay; Depend on!) Firebug for my HTML/CSS/JS work and I also hate having to use the mouse if I can get stuff done with a keystroke instead. (I’ll be writing a series of posts on how to avoid the mouse as much as possible in the near future.)

Firebug does come with a predefined hotkey to open/close the panel, but sadly that hotkey is F12 which I’ve already mapped to Exposé and am unwilling to give up. In theory This should be easy to fix by going to the System Preferences -> Keyboard And Mouse -> Keyboard Shortcuts panel and remapping there, but however much I tried I couldn’t get this to work. The solution? Risky and potentially ruinous hardcoding hackery of the plugin itself.

What I did was navigate to the .xul file within the Firebug folder buried deep within the user Library. The path below shows you where to find this file.

~Library/Application Support/Firefox/Profiles/nil9olmf.default/Extensions/firebug@software.joehewitt.com/content/firebug/browserOverlay.xul

Having opened this file in a text editor (preferably TextMate) I just did a search for the string “F12″, and lo and behold:

1
2
3
4
5
6
<keyset id="mainKeyset">
<key id="key_toggleFirebug" keycode="VK_F12"
command="cmd_toggleFirebug"/>
<key id="key_detachFirebug" keycode="VK_F12" modifiers="accel"
command="cmd_detachFirebug"/>
</keyset>

This line seemed pretty much what I was looking for. Crossing my fingers and with a silent prayer I merely changed the “VK_12″s to “VK_F2″s and Bob was, as they say, my uncle.

As is pretty much the case with anything I perpetrate against my Mac I don’t recommend you do this unless you’re ready to face the consequences. (I can’t imagine they’d be any more severe than having to reinstall Firebug, but still…) Chances are the problem only showed up in the first place because of my irresponsible messing about with stuff I should’ve left alone, but if you do have the same problem, here’s the fix.

Be aware also that you’ll have to repeat this procedure every time you update Firebug, so you may want to bookmark this blog and come back every day for the rest of your life.

4 Comments