« An Amazing Clock! | Main | Does Perl Use OS Threads on Win32? »
Making Your (Computer) Life Simpler: Automation
One of the things I like to do on computers is automate various tasks. Now, I'm not talking about things like disk cleanup, virus scanning, and other such mundane and boring tasks. I'm talking about slightly smarter things.
I often find myself create a lot of temp files. That is, I'll briefly download a file to use in a post or something like that. These files are rarely needed for more than just a few minutes. If I have them go to the desktop, then my desktop ultimately gets cluttered with stuff I don't need and stuff that I do need.
So, on my work machine, I created a directed called "Deleted Daily" where I can put temp stuff in. However, instead of deleting it myself every once in a while, I created a simple batch file:
rmdir /s /q "c:\Documents and Settings\Shane\Desktop\Deleted Daily\"
mkdir "c:\Documents and Settings\Shane\Desktop\Deleted Daily\"
The "/s" option is used to remove an entire tree. The "/q" option keeps it from prompting. Finally, the script recreates the directory. This batch file is then called every 4 hours throughout the day by using "Scheduled Tasks" within the control panel. The only issue is if you are using the directory right when it's deleted. This can be reduced by running it less frequently, but I like having it cleaned out so frequently I'll take care on what I put in there -- and what I don't.
I also have scripts that send me emails about various things. I'm more likely to read an email than I am to notice a popup when I'm not at the machine. This also allows it to run without interrupting my work.
Not all of these scripts have to run on a schedule, but causing them to do so helps simplify your life. They then become things you don't have to think about. Another way to have scripts run is to base them on triggers. That is, if a script runs every time you do action X, it can run more efficiently while also being more likely to run in a reliable method.
An example of this sort of script could be one that monitors for BMP files in a particular directory and automatically creates a JPEG out of the file. It's like running the script or action over the file, but with the added benefit that you can do it on files pasted or saved into there from another application.
All modern machines have various scripting options available to them for automating things from the mundane tasks to the advanced behaviors. Learning to use them can make your life simple and speed up your work.
Posted by Shane on February 8, 2007 8:55 AM | Permalink
TrackBacks
http://www.kf6nvr.net/mt/kf6nvr-tb.cgi/764




