Toggle Nocturne via Quicksilver on OSX

user-pic
Vote 0 Votes

Getting into the Mac world, I encountered two awesome tools from the same author; Nocturne, a tool which allows you to invert screen colors so your eyes doesn't go blind in dark places, and Quicksilver, a rapid application launcher allowing you to perform complex tasks with just a few key strokes. However, they don't integrate well together.... I can't seem to use Quicksilver to toggle Nocturne.... not until I wrote a quick AppleScript for it... And you can do it too!

Here's how I did it.

First, start Nocturne normally, and go to the preferences panel. Disable sensor auto switch... that will bump you right out of invert mode if you are in a bright enough place.

Then, enter night mode, and quit the application... it will auto revert back to day mode upon exit, but when you launch it again, it will start in night mode, which is what we want.

Next, go to script editor (Quicksilver > Script Editor, Enter) and create this script (copy & paste should do the trick):

Apple Script
property Disabled : false
tell application "System Events"
set TheList to get name of every process
repeat with i from 1 to the count of TheList
if item i of TheList contains "Nocturne" then
tell application "Nocturne" to quit
set Disabled to true
end if
end repeat
if Disabled is false then
tell application "Nocturne" to activate
end if
end tell

Save the script you've just created into ~/Library/Application Support/Quicksilver/Actions as Nocturne.scpt and you're almost ready to rock! Trigger your Quicksilver, use Command + R to force refresh of your catalog, and type Nocturne into the first box of Quicksilver. Because Quicksilver weights the application more heavily than your script, you need to hit down a few times to find the script instead of launching the application directly. I gave it three times and then Quicksilver learned that I want to use the script instead of real app... it might take you lesser or more, depending on how many times you've launched Nocturne via Quicksilver. But once it learns that, its all good.

Now, each time you want to toggle mode, just trigger Quicksilver, type Nocturne, and it'll switch day and night mode for you. Pretty neat huh?

Got it to work? Please let me know how things are working out for you via comments section :)

No TrackBacks

TrackBack URL: http://www.andyhuang.net/mt/mt-tb.cgi/22

Leave a comment