Saturday, September 18, 2010

Automating Disk Cleanup

Windows Disk Cleanup is a task that should be performed periodically to eliminate clutter. You may occasionally remember to run this program, but how often do you really do it. Did you know it can be scheduled?

Without too much hassle Disk Cleanup can be scheduled with Windows Scheduler, but it will only load, calculate how much space can be freed, and wait for user input. And a scheduled program that loads and waits for input isn't much help. But wait! There's more!

Did you know you can establish a set of rules that tells Disk Cleanup what you want cleaned and that it can be scheduled to run automatically without any user input? It's true.

I'll show you how it's done, but you might first want to have a look at the knowledge base article on this subject.

Got that? I thought so. Here's how it's done:

Establish the Rules
The first thing we're going to do is tell Disk Cleanup what to do when it runs.

1. Click Start, Run and type in the following to clean the C: drive:

cleanmgr /d c: /sageset:xxxxx

[Substitute xxxxx for any number from 0 to 65535]

Example:

cleanmgr /d c: /sageset:11

A Disk Cleanup Settings dialog box similar to the one below will be displayed.



2. Work your way down the list and check the types of files you want deleted. When you're done click okay.

3. Test your settings by running Disk Cleanup using the Run … command:

cleanmgr /sagerun:xxxxx

[Substitute xxxxx for the number you used in /sageset:]

Example:

cleanmgr /sagerun:11


Review: Disk Cleanup Parameters
Here's what we've learned so far.

a. You can run the Disk Cleanup program by clicking on Start, Run… .

b. You can establish a set of rules using the /sageset:xxxxx parameter.

c. The xxxxx can be any number between 0 and 65535.

d. You can specify what drive will be checked using the /d drive letter: option.

e. If you don't specify the drive letter option Disk Cleanup will be run on all the computer's drives.

f. You don't need to specify the drive letter with the /sagerun parameter because it was already specified with /sageset.

g. When you run Disk Cleanup with the /sagerun:xxxxx parameter you must use a number previously set with the /sageset:xxxxx parameter

h. You can establish 65,536 sets of Disk Cleanup rules on one computer. Far more than we actually need.

Scheduling the Task
Now that you're satisfied with the results of an automated Disk Cleanup you can set up the Scheduled Task to run weekly.

1. Go to the Control Panel and open Scheduled Tasks.

2. Double-click Add Scheduled Task to begin the Scheduled Task Wizard. Click Next to continue.

3. Scroll down the list until you see Disk Cleanup. Select it and click Next.

4. Name the Task or leave it as is and click on the radio button next to Weekly. Click Next to continue.

5. Select the time of day and the day(s) of the week you want this task to run. When you're done here click Next to continue.

6. Enter and confirm the password you have set for yourself on this computer. Click Next to continue.

7. Check the box to open advanced properties and click Finish. This will open the property sheet for the task. Note: If you forget to open the advanced properties at this point just locate the task in your task list, right-click and select Properties.

8. In the Run: text box you will see the command to run Disk Cleanup. Type in the /sagerun:xxxxx at the end of the command leaving a space between the end of the command and the /sagerun parameter. Substitute xxxxx with the number you used earlier when setting the Disk Cleanup rules.

Example:

C:\WINDOWS\system32\cleanmgr.exe

Becomes:

C:\WINDOWS\system32\cleanmgr.exe /sagerun:11

9. Ensure that Enabled is checked. Otherwise the Task won't run as scheduled.

10. Click the Settings tab.

11. Check the Wake the computer to run this task checkbox to ensure the computer will come out of standby when it 's time to run this task.

That's it; we're done. You can check the results by returning to Scheduled Tasks and checking the dates and run times in the Next Run Time and Last Run Time columns.

Tuesday, September 14, 2010

Garage Music Revisited

There are basically two requirements for trying to get older technology to perform today's tasks; time and patience.

I finally allowed myself the time to set up an old laptop computer in the garage to play music streamed from my network attached storage device. As for the patience, read on.

The computer is over 10 years old and it takes forever to load a Windows operating system, but it's only being asked to do one task - play music - and right now it's doing that better than my old PDA was. With old technology come comparisons to new technology. I quickly realized I have flash drives with more space than the computer has memory or disk space. Yet it manages to quickly come out of standby, connect to the network by way of an ancient Netgear MA401 802.11b PCMCIA card, and load iTunes.

It may not be the best way to access the music server and play iTunes, but it was all cobbled together from unused gadgets I had laying around the house, and it gives me a great deal of satisfaction knowing that I'm resourceful enough to more fully utilize my technological investments.

BTW, I did try a Puppy Linux Retro v.4.1.2 installation on an alternate hard drive before deciding to stay with Windows. A network connection was established, but couldn't be maintained after subsequent reboots probably due to our hidden SSID. I also had a problem getting Firefly Client to work. The Puppy distro did not include the Java JRE, and getting it installed and working with all its dependencies was too time-consuming.

I threw in the towel after several hours and dozens of time-consuming reboots on the ancient laptop because I already had Windows working. As I mentioned at the top of this post, time and patience are required when attempting to adapt or repurpose older technology, and there comes a time on every project when you have to know when to switch tracks and go with what you know will work.

What matters most is the end result, the finished product, the bottom line. And to that end I have my very groovy tunes to look forward each time I work in the garage. That's my story and I'm sticking to it.

Tuesday, August 24, 2010

Garage Tunes

I don't spend an inordinate of time in the garage, but it's nice to have some music when working on projects out there. Unfortunately the only garage-suitable music playing device I could round up was an ancient boom box with radio, cassette and CD player. I could use an mp3 player, but I'd rather not for safety reasons. The thought of not being able to hear a power saw - or my own screams as I remove a digit - above a Hendrix guitar solo is disconcerting. Then it occurred to me to try to stream tunes from our network attached storage device (NAS) and its built-in Firefly music server.

The NAS is basically a small computer with embedded Intel Atom microprocessor, two mirrored hard drives, and embedded Linux BusyBox operating system. The music server is compatible with Apple iTunes, Windows Media Player 12 and other media players.

Any PC in the house can attach to the music server over the local area network and play songs, albums and playlists. The music can be searched and sorted, and appears to be local to the PC.

A quick survey of extra computers and other network devices brought to light an old PDA that hasn't been used for years. It's a Toshiba E740 with built-in 11 megabit per second 802.11b. By today’s standards it’s old and slow. It runs early versions of Windows CE, Internet Explorer, and Windows Media Player. It was quite slow even for its day.

But it's wireless and it did connect to the network. Unforunately locating the music shared folder was troublesome, and getting Windows Media Player to locate the music server was impossible.

Fortunately there still is a lot of software available even for older operating systems, and I was able to locate MortPlayer, a free PocketPC music player. After a painless installation MortPlayer quickly found the NAS and the music shared folder, but not the music server. I attached a pair of A/C powered PC speakers to the headphone jack on the PDA and voilĂ  music to my ears.

With MortPlayer I have to navigate through the album within artist directory structure on the NAS and play one album at a time. It would be nice if it would play an artist's entire collection shuffled, but I'm not complaining, it's free and it works. As for playlists, MortPlayer does not play m3u playlists, but it does play Windows Media Player 12 playlists and I have a few of them on the server.

So that’s where it ends for now. Until I put a PC with iTunes or Windows 7 in the garage, a free music player on an old but reliable PDA with PC speakers will serve up my Garage Tunes.

Monday, August 23, 2010

How to "Bookmark" a PDF Read-Only Document

Have you ever had to close a lengthy PDF document you've been reading and then struggle try to find your place again after reopening it?

Maybe you would like to create a link to a specific page that has a table or other reference material you may want to view repeatedly.

Well here's a method for opening a PDF read-only document to a specific page from a command line. It can also be used in a shortcut, but we'll start with the command line.

Start/Run

The following command line - as run successfully using Start/Run - uses Adobe Reader to open a specific PDF document to page 24.

AcroRd32.exe /A "page=61=OpenActions" "C:\Documents and Settings\Ed\Desktop\motherboard_manual_ga-ma78gm-us2h_e.pdf"

You can copy and paste this command to open your document, but you will need to change the page number and the name and path of the document you want to open. The open and closed quotes for both parameters are required.

Each time you want to reopen the document press Start/Run - or the Windows Key + R - and change the number after "page=" to open the document to a specific page.

This can unfortunately be difficult to manage. For instance, after you have run this command several times, and possibly changed the number each time to reflect the current page, you will have created a long list of commands to reflect the different page numbers. The list will become longer if you also use this method to open other documents.

What's worse is if you run a program to clear out extraneous debris - as I do occasionally - and the registry key that tracks the Run command gets cleared out. In that case there's a solution; create a shortcut.

Shortcut

The target for the shortcut must be - as in the Run command - the Adobe Reader program itself, not the document.

First, right-click where you want to place the shortcut. Next, browse to the Adobe Reader program or type in its path and name. Mine is located here: C:\Program Files\Adobe\Reader 9.0\Reader, and the program name is AcroRd32.exe. It may be different on your system, but if you already have a shortcut to Adobe Reader, you only need to copy and paste it to the location of your choice and modify it to suit your needs. In my case I had to recreate it because it was not on the desktop or start menu.

Here is how the Target command line looks in my shortcut after it was modified to open the document of my choice to a specific page:

"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe" /A "page=61=OpenActions" "C:\Documents and Settings\Ed\Desktop\motherboard_manual_ga-ma78gm-us2h_e.pdf"

As you can see it's nearly identical to the Start/Run command. The only exception is the fully qualified name of Adobe Reader in quotes.

After the shortcut is created you will recognize it's icon. It's the bright red Adobe icon that ends up on your desktop each time you upgrade Adobe Reader, not the white document icon with the letters "PDF" at the top. You can change the icon back to the familiar PDF icon by way of the shortcut property sheet. There are several icons in AcroRd32.dll. Here's the path on my computer: %ProgramFiles%\Adobe\Reader 9.0\Reader.

If you are reading through the document and want the shortcut to reflect the current page, you should remember to modify the shortcut Target "page=" parameter before closing the PDF document. Otherwise you'll be taken back to the same page you were before.