Showing posts with label autohotkey. Show all posts
Showing posts with label autohotkey. Show all posts

Thursday, June 5, 2008

Monitor Standby Script Causes Problems Coming Out of Hibernation (Autohotkey)

One of my oldest, most favorite Autohotkey scripts had been a small, simple, piece of code that put the monitor on standby. It let me shut down my computer without forgetting to shut down the monitor (which I often did). However, recently I found out this piece of code had been the reason I was having a problem getting Windows XP to come out of hibernate.

The problem was that when I run my Autohotkey script to hibernate the computer (after running some utilities), sometimes when I come back and turn the computer on, it powers up but the OS never loads. The monitors show that it never gets a signal. I would have no choice but to unplug the computer altogether and then start it up again (sometimes it would return from its hibernate state, sometimes not).

Because of this problem, I'd begun only putting my computer on Standby instead of hibernate. However, out of a nagging need to be someone environmentally and energy conscious, I wanted to go back to hibernation, and went to figure out what the problem was.

The problem seems to have something to do with whether or not I shut down the monitors manually anyway; something trips up when the Autohotkey script tries to put monitors on standby that it can't find are on to begin with. Here is the offending code:

#m:: ; Win+M 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
For the moment, I just went ahead and deleted this code from my hibernate script, and I have had no problems yet. I'll just have to remember to shut the monitors down myself. If you know a workaround for this problem, do let me know!

Monday, April 21, 2008

Set Multiple Tabs as your Homepage on Firefox and AutoHotkey

Here's a handy tip for those who regularly check multiple sites at the top of their day, or as soon as they hit their browsers.

Firefox parses URL's into multiple tabs when separated by the "|" character (shift-\). Hence, you can enter multiple url's as your homepage by entering:

https://www.google.com/ig | http://www.yahoo.com | http://lifehacker.com

If you use Autohotkey, you can also use it to open multiple tabs by the same syntax:

run, https://www.google.com/ig | http://www.yahoo.com | http://lifehacker.com

Of course, use discretion when you start up Firefox with multiple tabs; opening up too many at once could slow Firefox down significantly.

Friday, March 21, 2008

Autohotkey Script to Put Monitor on Standby

This is a bit of a rehash of a larger article I wrote months ago highlighting my main Autohotkey scripts, but I saw in the search stats that some people were specifically looking for an autohotkey script to put one's monitor on standby.

Here it is, the way that I use it. It puts the monitors on standby by hitting Win+M:

#m:: ; Win+M 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
Don't ask me for a line by line explanation more than what's already annotated in the script itself; I have no idea.

I can't find the original Autohotkey forum post in which I found this specific script, but this forum post has more info.

p.s. - for those of you not in the know, Autohotkey is an extremely versatile program that lets you write scripts as simple as automating windows tasks (like moving a mouse, or opening a folder with a keystroke), to writing full on programs and mods.

Sunday, February 10, 2008

Getting Rid of Minimize with Double Right Click

One of the more novel and simple Autohotkey scripts I ran into a while back let you minimize the current window by double-right-clicking. For people who are manage lots of windows and apps, and have a lot of icons in the desktop, this can be really useful. In fact, I featured it in the "My Auto Hotkeys (and shutdown via text message)" article a while back.

However, I've come to realize that I didn't really need this script all that much. First of all, I've gotten rid of all the icons on my desktop and keep my desktop folder as a toolbar in my taskbar. Secondly, I've more often found that it interferes with using Mousegestures, a Firefox extension I'll be featuring soon, which let you control the browser by dragging the right mouse button (drag left to go back, drag right to go forward, up to open new tab, etc). If I had to choose between keeping Mousegestures or Double-Right-Click, I just stuck with Mousegestures.

Anyway, for those of you still interested, the autohotkey script for minimizing with double right-click is:

~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

Remember, greasing one's PC means not only tweaking one's computer by adding new features, it also means removing unnecessary ones.

Friday, February 8, 2008

Autohotkey: Empty Recycle Bin With Hotkey

I have no idea why I had a much less elegant solution to this process before (which involved calling a separate program that emptied the recycle bin, but still having to press enter to confirm it), but I guess there is a super simple Autohotkey command that empties the recycle bin quickly and painlessly:

FileRecycleEmpty [, DriveLetter]

If you use just FileRecycleEmpty, it empties all of the Recycle Bin. If you add a comma and the drive letter as "C:\" or "D:\" it empties just those drives' folders. I never differentiated between the drives' Recycle Bins before, so I really only care to remove everything. Currently, my hotkey for emptying the Recycle Bin is such:

!x:: FileRecycleEmpty


Which empties the Recycle Bin by hitting ALT-X.

As always, to use these scripts and many others to enhance your Windows experience, you need Autohotkey. For more articles on using Autohotkey, and the scripts that I personally use, check out the other articles on this blog labeled "Autohotkey."

Wednesday, February 6, 2008

My Mozyhome Automation Script:

As I mentioned in a previous post, I really like Mozyhome but I don't like having it constantly running in the background; it really only needs to run when it performs a backup, and any other time it shouldn't be wasting my RAM and CPU. So here's a handy Autohotkey script I've written that'll automate starting, running, and killing Mozyhome automatically.

Here's the full script, which I've called mozybackup.ahk:

#SingleInstance force
DetectHiddenText, On
SetTitleMatchMode 2
SetTitleMatchMode, Slow

run C:\Program Files\MozyHome\mozystat.exe

Sleep, 5000

run C:\Program Files\MozyHome\mozystat.exe

Sleep, 10000

WinWait, ahk_class wxWindowClassNR
IfWinNotActive, ahk_class wxWindowClassNR, , WinActivate, ahk_class wxWindowClassNR,
WinWaitActive, ahk_class wxWindowClassNR,
MouseClick, left, 347, 41

WinWait, ahk_class wxWindowClassNR, 1 minute ago
Run, C:\Program Files\PSTools\pskill.exe "mozybackup.exe"
Run, C:\Program Files\PSTools\pskill.exe "mozystat.exe"
Run, C:\Documents and Settings\Arvin\My Documents\scripts\finishedbackup.txt

Alright, now let's go through each part of the script to explain what it does, in case you need to alter parts of it later on (which I'm sure you'll have to).

#SingleInstance force
DetectHiddenText, On
SetTitleMatchMode 2
SetTitleMatchMode, Slow

This part kind of sets the tone for the rest of the script. The first line makes sure only one instance of the script is running. The next three lines sets Autohotkey to actively and thoroughly read the text inside currently open windows. You'll see why this is important later.
run C:\Program Files\MozyHome\mozystat.exe

Sleep, 5000

run C:\Program Files\MozyHome\mozystat.exe

Sleep, 10000
This part runs Mozyhome. If you installed Mozyhome into a different directory, change the file path as appropriate. The reason I call the program twice is because mozystat.exe usually starts minimized in the system tray, where I can't get at it. The second run command brings up the Mozyhome window to the top of the desktop. The long sleep times allow time for Mozyhome to properly load in plenty of time.

WinWait, ahk_class wxWindowClassNR
IfWinNotActive, ahk_class wxWindowClassNR, , WinActivate, ahk_class wxWindowClassNR,
WinWaitActive, ahk_class wxWindowClassNR,
MouseClick, left, 347, 41

This part waits for activates the Mozyhome window if it hadn't already (wxWindowClassNR is the ahk_class or window class of the Mozyhome window). The last line clicks the "Start Backup" button on the Mozyhome window, which starts the backup.
WinWait, ahk_class wxWindowClassNR, 1 minute ago
Run, C:\Program Files\PSTools\pskill.exe "mozybackup.exe"
Run, C:\Program Files\PSTools\pskill.exe "mozystat.exe"
Run, C:\Documents and Settings\Arvin\My Documents\scripts\finishedbackup.txt

The first line of this next section waits for the Mozyhome window to display the term "1 minute ago," which would show up as soon as the backup finishes. The script is paused at this point until that phrase in that window pops up.

Once it finishes, it runs PSKill to kill the mozybackup.exe and mozystat.exe processes. I'd featured PSKill before, but basically it force closes the specified processes. I've put pskill.exe into a folder called PSTools in my Program Files folder, but again, if you've put it elsewhere, make sure you put the right path in there.

Finally, the last line opens a text file called finishedbackup.txt that I'd prewritten and saved in my scripts folder that just simply says "Finished backup!" I just put it in there to let me know the backup finished successfully. You don't need to do this part, or customize it yourself with whatever text file you want. I decided against using a MsgBox because the script won't close unless the OK button on the MsgBox is clicked. With the text file, the script can open the file, and then close itself.

And there you go! To run this script, either just run it by double clicking whenever you want to, or incorporate it into another script and have it run from a specific keystroke. I have it run as part of my computer's shutdown routine, which I invoke with a simple ALT-H at the end of the night, or in the morning before I head out to work.

Friday, February 1, 2008

Minimize Icons in System Tray

This is something I'd already done months ago, but to save time I'd rather point to a well-written and comprehensive article from Help2Go about how to remove icons from your system tray.

While to me the most important thing about the system tray is to make sure you don't have too many applications running at once anyway (which is why I personally frown on too many small productivity applications running at once), there is still something you can do for the system tray apps that you just can't get rid of.

For the record, 90% of the time the only icons that populate my system tray (along with the clock) is Miranda, AVG anti-virus, volume, Ultramon, and my ubiquitous autohotkey Hotkeys script. But using the hide feature like shown in the Help2Go article, Miranda's the only one that's always showing.

Tuesday, January 29, 2008

Selectively Start and Stop Services with sc.exe and AutoHotkey

I recently got a copy of Corel Painter X and noticed that after installing, there was a new Windows service that kept starting up called ProtexisLicensing. Looking online confirmed that it was required to validate your copy of Painter. The problem is Painter needs to be validated by ProtexisLicensing every time it starts up, and if ProtexisLicensing isn't running when you start up Painter, Painter won't load up at all.

I don't use Painter enough to be fine with this background process taking up several megabytes to load every time I start Windows. Luckily, with the help of a utility called sc.exe and Autohotkey, we can tweak the Painter shortcut to start up Protexis Licensing before running Painter, and then turning it off when Painter is closed.

First, download sc.exe . I can't find a specific download location right now, but just google for it and you should find it eventually. It's a Service Controller that lets you start and stop your installed Windows services, among other useful features that I haven't gotten to learn about yet.

Next, create an autohotkey script. Mine is called painter.ahk. The code looks like this:


Run C:\Documents and Settings\Arvin\My Documents\scripts\sc.exe start ProtexisLicensing

Sleep, 1000

Runwait C:\Program Files\Corel\Corel Painter X\Painter X.exe

Run C:\Documents and Settings\Arvin\My Documents\scripts\sc.exe stop ProtexisLicensing
The paths of these files might differ depending on where you put your downloaded sc.exe and installed Painter, so alter as necessary.

What this script does is calls sc.exe to first start the Windows service ProtexisLicensing. Then it waits 1000 ms (1 second), and then runs Painter. RunWait is a command that basically means "run, then pause the script until such and such file is closed." So once Painter is shut down, it runs the next line, which stops ProtexisLicensing.

Then, you can change your start menu or Desktop shortcut for Painter to point to this script instead of running Painter X.exe.

To do this right click on the shortcut, and click Properties. Then change the target to point to the new Autohotkey file. Change "start in" to the folder in which the script is located.

Likely once you fix this the icon will change to the Autohotkey icon. To change this, go to the properties of the shortcut again and hit "Change icon." Then go to to location of the installed Painter.exe file and select it, with its proper icon.

Finally, hit Windows>run>services.msc to load the Services control window. Find the ProtexisLicensing service and set it to disabled (you can also stop it right then). From here on out ProtexisLicensing will no longer run at startup, or ever with the exception of when you call it.

And that's it! Save yourself some RAM space!

Of course, you can use sc.exe and Autohotkey to do this for any other Windows service you have that doesn't need to run every time. Just be sure you know exactly what those particular services affect. For more information, see how I took command of my Windows services.

Tuesday, January 22, 2008

PSKill: Kills Processes Dead (great for gaming!)

As my computer gets older, playing current generation games on my computer becomes all the more resource intensive. This is why it's important for me to shut down as many nonessential processes to free up RAM and CPU before playing my game.

Unfortunately, most of us probably have a LOT of background programs running, and it's a pain to close them one by one from the taskbar and the system tray. They're even worse when the processes can only be shut down from the Task Manager (CTRL-ALT-DEL), by force ending the process.

PSKill is one of the PSTools Microsoft and Sysinternals released to locally and remotely administer certain Windows functions via the command line. PSKill's purpose is to force the shutdown of open processes.

I use PSKill with Autohotkey to ensure the immediate shutdown of all the processes I don't need, and I keep it all in an autohotkey file called close.ahk. Running the script immediately shuts down the list of processes I've specified.

Please make sure that you know what the process you're shutting down does, as it may cause Windows to crash or behave improperly, or for you to lose unsaved changes.

To use within Autohotkey, just use this script:

Run, C:\Program Files\PSTools\pskill.exe "firefox.exe"
Where "firefox.exe" can be any process you want to kill. I put PSKill in a PSTools folder in Program Files myself. You can do the same or put it anywhere else you want, just change the path.

I also use the following script to clear the icons that might remain in the system tray even after you kill the process. Don't ask me to explain how it works, it just does, and credit goes to a certain Autohotkey forum user's post which I can no longer find. If you read this, dear user, let me know and I'll give you proper credit!
;;;; REMOVE ICONS FROM SYSTRAY;;;;
TrayIcons:
TrayIcons()
Return

TrayIcons(sExeName = "")
{
DetectHiddenWindows, On
idxTB := GetTrayBar()
WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd

hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
pRB := DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 20, "Uint", 0x1000, "Uint", 0x4)

VarSetCapacity(btn, 20)
VarSetCapacity(nfo, 24)

SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_BUTTONCOUNT
max = %errorlevel%

Loop, %max%
{
i := max - A_index
SendMessage, 0x417, i, pRB, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_GETBUTTON

DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pRB, "Uint", &btn, "Uint", 20, "Uint", 0)

dwData := NumGet(btn,12)

DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "Uint", &nfo, "Uint", 24, "Uint", 0)

hWnd := NumGet(nfo, 0)

WinGet, pid, PID, ahk_id %hWnd%

ifwinnotexist, ahk_id %hWnd%
{
idx := i+1
;MsgBox, 4, , Delete tray icon %idx%?
;IfMsgBox Yes
deletetrayicon(idx)
}

tmp = index=%a_index%, i=%i%, pid=%pid%`n
strayicons .= tmp

}

DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pRB, "Uint", 0, "Uint", 0x8000)
DllCall("CloseHandle", "Uint", hProc)

Return sTrayIcons
}

DeleteTrayIcon(idx)
{
idxTB := GetTrayBar()
SendMessage, 0x416, idx - 1, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_DELETEBUTTON
SendMessage, 0x1A, 0, 0, , ahk_class Shell_TrayWnd
}

GetTrayBar()
{
WinGet, ControlList, ControlList, ahk_class Shell_TrayWnd
RegExMatch(ControlList, "(?<=ToolbarWindow32)\d+(?!.*ToolbarWindow32)", nTB)

Loop, %nTB%
{
ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
hParent := DllCall("GetParent", "Uint", hWnd)
WinGetClass, sClass, ahk_id %hParent%
If (sClass <> "SysPager")
Continue
idxTB := A_Index
Break
}

Return idxTB
}

I've even customized the Steam (the game launcher for games like Half-Life and Team Fortress 2) shortcut to instead run a special steam.ahk script that first runs close.ahk, then runs steam.exe (it also shuts down my two other displays). This way I only have to click one icon to everything.

Next I'll go over the script that turns everything back on after I play the game. Also all automatic!

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 15, 2008

MozyHome Settings

I'd already gone over Mozy twice now in previous posts, but this time around I'll go over the exact custom settings I use, as well as other tweaks to make sure not only that my important data is backed up but also that MozyHome stays out of the way as much as possible.

First and foremost, here's a screenshot of the Backup Sets I currently have:


I've kept the music set turned off because I have far more music than the 2 gigabytes of free space MozyHome gives you for free, plus those are backed up in my MP3 player anyway. Notice that I have it set to back up my instant messenger logs as well as my Firefox bookmarks.

Next, here is my Options window. Emphasis is on making it user-friendly when it's running, but out of the way when it's not needed:

Then, in the "Schedule" tab, I have it set to suspend automatic and scheduled backups. With my Autohotkey-scripted Standby/Hibernate routine set to go every night (or whenever I press Alt-H), MozyHome runs at least 7 times a week, oftentimes more (as I usually run the routine when I leave for work and when I go to bed). This way I can keep MozyHome shut down 99% of the time, not taking up extra resources. Speaking of which, I have the MozyHome backup Windows Service set to Manual so it doesn't become part of the startup routine.

Here's the Autohotkey script that controls Mozy's functions:

run C:\Program Files\MozyHome\mozystat.exe

Sleep, 5000

WinWait, MozyHome Remote Backup (1.8.4.7) - Status,
IfWinNotActive, MozyHome Remote Backup (1.8.4.7) - Status, , WinActivate, MozyHome Remote Backup (1.8.4.7) - Status,
WinWaitActive, MozyHome Remote Backup (1.8.4.7) - Status,
MouseClick, left, 210, 18
Sleep, 8000
Send, s
Sleep, 5500

WinWait, MozyHome Remote Backup (1.8.4.7) - Status, 1 minute ago
Run, C:\Program Files\PSTools\pskill.exe "mozybackup.exe"
Run, C:\Program Files\PSTools\pskill.exe "mozystat.exe"
Run, C:\Documents and Settings\Arvin\My Documents\scripts\finishedbackup.txt
The first WinWait routine waits until Mozyhome finishes loading, activates the window, then hits "S" to start the backup.

The second WinWait routine waits until the phrase "1 minute ago" shows up in the window. This means that the backup just finished. It then runs PSKill, a utility used for fast killing processes (MozyHome won't just quit by closing the window). Finally it opens up a premade text file that says "Backup Finished!" which awaits me when I bring the computer out of standby.

(Feel free to use the script and tweak it as you wish. I claim no responsibility for how you choose to use and modify it, and how it affects your system).

Remember, MozyHome offers 2 gigabytes of space free, and unlimited storage for $4.95 a month. I also get an extra gigabyte of space per user I refer, so please click on the link and sign up for this great service!

Tuesday, January 8, 2008

Macros, October 15, 2007

Continuing on, another entry from my "personal journals" dated October 15, 2007:

First off, I've become slowly addicted to computer macros via the awesome program AutoHotKey. It lets you create automation and hotkey based batch programs of incredible depth and versatility.

My first hands on experience with automation programs was earlier in the summer during an online contest I had joined. Using Automation Anywhere, a program for which I only had the demo, I was able to friend hundreds of voting members every hour to the point where I'm still by far the user with the most friends, and certainly helped me secure 2nd place in the competition. Even that program I found somewhat complicated, and it never performed exactly as I needed it to.

I vaguely recall Autohotkey back then also, but it was impossible to understand when I first loaded it up, and moved on.

The first automation program I ran was from a few weeks ago when I got WakeUpOnStandby, a freeware standalone program that woke my computer up from Hibernate at a predetermined time (8 am), so I could power down my computer overnight (helping fulfill my "Be Greener" New Year's Resolution), but be ready to roll as soon as I wake up. My computer had never been powered down so much, for so long, in forever.

The next program I used was Batchrun, which was simple in that it really only could run, close, and delete programs. My goal was to have it be able to singlehandedly close down all the processes that I needed closed whenever I should play a computer game (namely Team Fortress 2 and the rest of the Half Life Orange box when it arrived), and then another program to turn them all back on when I finished playing.

It worked well enough except some programs wouldn't close right, and, desperate, I turned back to Autohotkey.

Autohotkey was still very oblique when I powered it up, but somehow (I can't even remember it now), I figured out the intricacies of its interface (basically you just code it all in Notepad!), and found the code (and extra app PSKill) I needed to end the processes I wanted perfectly and quickly, and also open them back up.

Since then I've realized the possibilities this opened up for me. I tweaked the Open programs code to include resetting the color palette of my video card after I played. This was an annoying bug via my video drivers that I still haven't been able to fix, and I feel very empowered to have just written (okay, Autohotkey comes with an action recorder function much like Automation Anywhere that can duplicate all mouse and keyboard actions you choose) a code that will just do it for me very quickly.

I've even expanded the capabilities of WakeUpOnStandby so that I can run a script that turns the program on right before I put it on hibernate, so I don't have to keep it on at all times now so as not to risk having it inadvertently off when I put the computer on hibernate. This way I can save even more system resources by turning WOSB off also when I play my games.

But that's not all. I figured out how to get it to automate tedious internet tasks. I was annoyed when the online contest announced that voting was now enabled daily, which meant I would have to vote for myself daily if I wanted any chance at all of making it to the next rounds. So I set up a script to run that opens firefox, logs me in, and votes for me automatically. I set it to run in the morning after WOSB turns the computer back on, so unless I did it wrong (haven't tested it under real conditions yet), it should have done it before I wake up!

I tried to get it to load the aLiveJournal site up and click on the ranking sites and an add also, but it was having some problems I didn't have the time to fix. As soon as I figure that out, I'll have that run in the morning as well.

Then after that I'll set up another friending program for the contest, and then possibly a commenting program! Then I'd be unstoppable!

Now I get all overexcited just wondering what other things I can schedule for it to do (probably run defrag and autobackup)
As an epilogue, the second time I joined the contest, I ended up ranking 7th in the final round, versus the 2nd I did the second time around. Not bad for not asking help from friends, just AutoHotKey.

Thunderbird, Firefox, and Backups, October 10, 2007

Continuing from excerpts taken out of my "private journals" written back in October of 2007.

On the internet side of things, I've started taking advantage of Mozy, a free online backup tool that gives you 2 gigabytes and a program that automatically backs up certain file types and folders you specify. I'm not a huge fan of adding more background running programs, since I was already running google desktop, but I couldn't think of any other way to make sure the backups are made... I think I'd just forget. I might learn Windows Scheduler if I can use that somehow, but for the moment I need to start referring friends to it so I can get the free gig per referral.

With my being given a huge external hard drive for backups by [the production], hopefully the inevitable hard drive crash won't be nearly as overwhelming now, although there is a lot more data at stake the next time it happens.

On a related note, I researched remote desktop utilities on the hope that should I forget stuff at home, I can always connect to my home computer and look it up. Unfortunately for the moment I wasn't able to find a full featured freeware option that was also secure enough right out of the (digital) box. I'll have to shelf this idea for the moment until I can find the time to devote to it.

For Firefox, as with the others, it was all about tweaking the most performance out of it, uncluttering the desktop as much as possible, and using extensions that take those extra windows and mouseclicks down. I was also able to find a program that made backups of my extensions and tweaks, as by this point I'd made so many changes to the program that I wouldn't remember how to restore it in case I have to start over.

One extension [Searchwords] involved adding keyboard shortcuts as substitutes for using the search window. Now I can just install a search engine, give it a code letter like "g" for google or "y" for youtube, and just type "y jurassic park" into the address bar and it searches youtube for jurassic park clips. This took down the number of input bars on Firefox from 3 to 1, and gave it so much more room.

Online wise, I've started using iGoogle, which is a customizable home page portal where I was able to get notifications and previews of my email and yahoo mail, weather, and other gadgets like dontbreakthechain and a calendar.

(editor's note: Dontbreakthechain is the web application I used to keep track of my exercises and other daily routines, like making my bed)

Most importantly, though I was also about to put an RSS reader into the igoogle page, namely Google Reader. Now I'm able to keep up to date on all my favorite blogs in one place, saving me having to do a lot of typing and clicking. I'm excited whenever I get to bookmark yet another interesting blog, knowing that I'll never forget to check it in the future.

Thunderbird went through the same treatment of extensions and consolidation and purging of unnecessary buttons. Most importantly, though, I finally went super nuts on putting everything into categorized folders. I'd done this to my laptop back when I was in Jersey but importing the organization into my desktop did not handle very well. I still need to reinstitute all the filters I had to put them all in the right folders, along with probably having to create folders for the "Sent" folder as well.

Finally, I've started using Autohotkey, a batch process program to let me open and close multiple programs in one doubleclick. Eventually I'd like to learn to write batch programs myself, but for now this is an excellent choice.
The preceeding wasn't changed much from the original entry back in October, other than adding links to the respective applications. As such, many of these tweaks have become obsolete (upgraded or removed altogether).

Don't fret though, cause I plan on catching up real soon. I just wanted to really let you in on the process by which I got to my present configuration.