Originally published on: 2/2/2006 6:41:05 AM
Give me six hours to chop down a tree and I will spend the first four sharpening the axe.
Even though I just heard the quote this week for the first time, I've believed it for a long time. I'm a HUGE fan of the principle of making sure your tools are up to your tasks. That's why a lot of my software is this "lifehack" kind of stuff. By having these tools handy, I am better able to do the primary task at hand.
A prime example is that the current large client I'm working with wants weekly updates on what milestones have been reached, what was planned, but didn't get done, etc. They handle this through a basic spreadsheet.
However, more than once I've forgotten to do it on Friday afternoon. Now, I could have just set up an Outlook reminder, but instead I put together a quick PHP script that copies the last report into a new Excel file and opens it. Pretty basic stuff, but now I just get a spreadsheet opened in front of me to fill in instead of yet another little alarm bell. Several layers beyond this would be fairly easy and I can see value in doing so.
The most basic is the one I need right now. It just finds the most recent file in the directory I use to store these and copies it to a new file with the current date. I then added it to the Windows Scheduler for Friday afternoons, so "today" as a date works just fine.
< ?php
$status_report_dir = "H:\status";
$source_file = "";
if ($handle = opendir($status_report_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if(filemtime($status_report_dir . "\\" . $file) > $file_m_time){
$file_m_time = filemtime($status_report_dir . "\\" . $file);
$source_file = $file;
}
}
}
closedir($handle);
}
$new_time = strtotime("Today");
$new_file = $status_report_dir . "\\" . date("Y-m-d",$new_time) . "-JWynia.xls";
copy($status_report_dir . "\\" . $source_file,$new_file);
exec($new_file);
?>
If you have PHP set up as an executable format (with .phx opening automatically with php.exe), you can just add the .phx with the above code (modified for directories and filenames obviously) to the Windows Scheduler. Otherwise, make a quick batch file right next to the .php file and put:
php newstatusreport.php
into the .bat file. Then, have Windows run that on the scheduled time. This does require that you have PHP as a commandline interpreter set up and that php.exe is on in your PATH environment variable.
What you'll get is the newly named file popped up in front of you. This is just a straight copy, so all of the internal details are going to have to be updated by hand.
If *that* bugs you (and I'm sure it will bug me by the 3rd week or so), you can take advantage of the little transparent trick that MS Office (I think from version 97 on) does with HTML. Any HTML file renamed to an Office file format (Word and Excel and I think Powerpoint) will open transparently as though it was the native file format.
So, you can do easy document creation by just building the necessary HTML with PHP, saving it out as an .xls and opening it. For Excel, you just create a big HTML table that is your spreadsheet. You can put in formulas like "=A2+B6" and it will do the calculations, etc. If, like in the example case above, you're starting with someone else's Excel file, export a sample from Excel to HTML and replace the right bits with PHP code to prepopulate dates.
Push this one step further and you could hook the script into Outlook and grab all tasks completed in the last 7 days (possibly restricted by category), putting them into the "milestones" section of the report. This isn't as difficult as it sounds. I've got some Javascript code I've been using in a custom "Outlook Today" page that would do pretty much this exact thing if ported to PHP.
Combining all of this will give you a nearly effortless weekly report of accomplishments. Quite frankly, this would also work well for those who don't even have to send any sort of milestone reports to clients or employers. It's one of the best ways to actually build up your resume. If you're tracking your tasks and accomplishments as they happen into Outlook and can pull out reports, you've got plenty of resume fodder to use. Every resume expert I know of talks over and over about how important it is to cite specific accomplishments on your resume. And, lots of people have a hard time thinking of what they actually did last year or even last month. So, let the computer do the work.