Showing posts with label miranda. Show all posts
Showing posts with label miranda. Show all posts

Friday, January 18, 2008

My Auto-Hotkeys (and shutdown via text message!)

Update: The "Empty Recycle Bin" command I refer to below is now obsolete. A much simpler command, "FileRecycleEmpty" takes care of it all, without the extra Enter keystroke. Check my linked article for more info.

Update 2: I've since also removed the option to minimize with double-right-click. To see why, check out this article:

The following is the autohotkey file that I keep open at all times, keys.ahk. It contains hotkeys I use often, and I'll explain what these do afterwards. If you want to use this file as a template for what you do, and you have autohotkey installed, just copy and paste the entire thing into a text file with the extension .ahk:

#SingleInstance force
DetectHiddenText, On
SetTitleMatchMode 2
SetTitleMatchMode, Slow

WinWait, ahk_class #32770, *******: standby
WinActivate
WinClose
Run C:\Documents and Settings\Arvin\My Documents\scripts\hibernate.ahk
Reload

!o:: Run C:\Documents and Settings\Arvin\My Documents\scripts\open.ahk
!c:: Run C:\Documents and Settings\Arvin\My Documents\scripts\close.ahk
!h:: Run C:\Documents and Settings\Arvin\My Documents\scripts\hibernate.ahk
!s:: Run C:\Documents and Settings\Arvin\My Documents\scripts\
!q:: Run F:\Video Projects\
!e:: Edit
^!r:: Shutdown, 6
!x::
Run C:\Documents and Settings\Arvin\My Documents\scripts\EmptyRecycleBin.exe
Sleep, 500
Send, {Enter}

~RButton::
If (A_PriorHotkey != A_ThisHotkey OR A_TimeSincePriorHotkey > 500)
Return
Sleep 200 ; time for context to appear
Send {Esc} ; close context menu
WinMinimize, A ; minimize active window
Return

#m:: ; Win+O hotkey that turns off the monitor.
Sleep 1000 ; Give user a chance to release keys (in case their release would wake up the monitor again).
; Turn Monitor Off:
SendMessage, 0x112, 0xF170, 2,, Program Manager ; 0x112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER.
; Note for the above: Use -1 in place of 2 to turn the monitor on.
; Use 1 in place of 2 to activate the monitor's low-power mode.
return

Let's go through what each part means:
#SingleInstance force
DetectHiddenText, On
SetTitleMatchMode 2
SetTitleMatchMode, Slow
The first line makes sure only one instance of the script is running at a time. The 2nd to 4th lines allow the script to monitor the text contained within the open windows. This is important for the next sectoin of scripts:
WinWait, ahk_class #32770, *******: standby
WinActivate
WinClose
Run C:\Documents and Settings\Arvin\My Documents\scripts\hibernate.ahk
Reload
This section waits for the existence of a window that's got the ahk_class of 32770 (you can see what the class of a window is using the AutoHotkey Window Spy), and contains the text "******: standby" (edited for security).

Basically, this waits for a Miranda IM window from my mobile phone (I send the im using text message) that says: standby. Autohotkey then closes the IM window, then runs my hibernate computer routine (I'll show you that soon as well!), and then reloads the keys.ahk script. Again, I plan on elaborating on this process in a future article.
!c:: Run C:\Documents and Settings\Arvin\My Documents\scripts\close.ahk
!o:: Run C:\Documents and Settings\Arvin\My Documents\scripts\open.ahk
!h:: Run C:\Documents and Settings\Arvin\My Documents\scripts\hibernate.ahk
!s:: Run C:\Documents and Settings\Arvin\My Documents\scripts\
!q:: Run F:\Video Projects\
!e:: Edit
^!r:: Shutdown, 6
These are the various hotkeys that make navigating my computer a snap. The symbol (!) implies holding down the ALT key, so "!c" means hitting ALT-C runs my "Close programs" routine (close.ahk) . I use this to shut down programs in the background that I want to shut down if I really want to free my system resources up, like for playing a game or video rendering. Open.ahk reopens those programs when I'm done.

The commands that run a directory open that directory when the keys are pressed. !e:: runs the "Edit this script" command. And finally, "^!r" (Shift-Alt-r) force restarts my computer.
!x::
Run C:\Documents and Settings\Arvin\My Documents\scripts\EmptyRecycleBin.exe
Sleep, 500
Send, {Enter}
Hitting Shift-X runs emptyrecyclebin.exe, a free utility that empties the recycle bin. The next 2 lines waits 500 milliseconds, and then the computer sends and "Enter" keypress. This is because while the emptyrecyclebin program empties the recycle bin, if you still have the Recycle Bin set to ask you if you want to permanently delete the files within, you still have to press OK (or hit ENTER, as OK is already highlighted).
~RButton::
If (A_PriorHotkey != A_ThisHotkey OR A_TimeSincePriorHotkey > 500)
Return
Sleep 200 ; time for context to appear
Send {Esc} ; close context menu
WinMinimize, A ; minimize active window
Return
I got this script from Lifehacker, I believe. It lets me double-right click to minimize the current active window. Neat, though I still need to remember to use it more often.

#m:: ; Win+O hotkey that turns off the monitor.
Sleep 1000 ; Give user a chance to release keys (in case their release would wake up the monitor again).
; Turn Monitor Off:
SendMessage, 0x112, 0xF170, 2,, Program Manager ; 0x112 is WM_SYSCOMMAND, 0xF170 is SC_MONITORPOWER.
; Note for the above: Use -1 in place of 2 to turn the monitor on.
; Use 1 in place of 2 to activate the monitor's low-power mode.
return
Finally, that part sends the monitor into standby mode by pressing Windows-M. I believe I got this script from the Autohotkey forums.

And that's it! Hope that inspires you to write your own super-simple script that automates much of your repetitive tasks!

Tuesday, January 8, 2008

Google Desktop and Trillian, October 4, 2007

This was the second entry taken from my "private journals" back in October of 2007 when I began my earnest optimization effort.

Last entry I spoke about finding a desktop theme that among other things, matched the satin black look of Google Desktop search's sidebar and gadgets. Now I'll go into Google Desktop search.

Most of my cravings had come from Lifehacker, which I'd become addicted to of late (I still need to read the archives and check out the other software tweaks I've been missing)

First I tried using a program called Launchy that was supposed to streamline launching apps and folders by having me type in a shortcut of the program name. But it didn't index files nearly fast enough, and I couldn't find a suitable skin for it (this was even before I got desktop themed out). Then I saw Rainlendar, a calendar app, that looked promising, and for a while I had both of them running.

Then it turned out Google Desktop search could do all of these things, and have a more unified look. I never used it before because it seemed like a huge tax on computer resources, but with most of the hard processing work being done here at TO, most of the stuff I do at home has been just moderate. Immediately I fell in love with the little gadgets it offered, and eventually rearranged the entire 2nd monitor to maximize information (currently a big clock, a run program launcher, weather, calendar, and a scratch pad for notes).

Desktop search itself hasn't been that revolutionary for me yet, but I don't think it's done indexing. I'll give it a few more days and see if it does indeed make it easier for me to find stuff I want, but I've heard its database can grow to be gigantic, and if it becomes an impediment, then I might jettison it and keep my gadgets.

Finally, I switched over from AIM finally to Trillian, which I'd tried before but found to be TOO full featured to be worth replacing AIM with, but since I'd been using deadaim for logging, I couldn't skin it, due to DeadAIM not being compatible with the newer AIM versions that supported skinning (the newer versions of AIM also look awful and slow).

Skinning was important because with all the black in my screen now, the huge white buddy list window stuck out like a sore thumb. The new versions of Trillian are great because they offered skinning (and I found a good black skin) as well as a more full-featured logger. I'll have to get used to not being able to immediately search logs from the past few years via DeadAIM, but otherwise it looks like I'll be sticking to Trillian Pro (Trillian Basic was pretty crappy, so I went with a cracked version of Pro).

Next I'll get into backups, remote access (which I haven't set up yet), and Firefox and Thunderbird.