Minimizing Scheduled Scripts
For most of my day I'm sitting at a Windows XP Pro machine. That's where I work in Word, Photoshop, Homesite, Notepad, and other programs I use to get stuff done. And I'm a big fan of the Windows Task Scheduler. Well, more accurately I'm a big fan of setting little scripts to run at certain intervals. I have about a half dozen of them on my home computer right now.
One script grabs the current Amazon sales rank for a specific book and saves it in a CSV file. Another script grabs a mutual fund price from Yahoo! Finance and emails it to me. Another is simply a reminder script that sends me an email every Sunday afternoon saying, "Don't forget to send out ORblogs Weekly." All of the scripts are written in Perl.
So far so good. I'm automated. I'm informed. I'm being reminded of important things. But every time one of these little scripts runs, this pops up on my screen:
A blank command prompt. Argh. I'm writing away in Word, or writing an email, or posting to my blog and all of a sudden this black box pops up for three seconds while the script runs and then vanishes. There's no "run minimized" option in Windows Task Scheduler. (why not?) And there's no "run minimized" switch for Perl. (why not?) So today as the fifth black box made its appearance I lost it and decided to find a way to run these scripts minimized.
Here's the solution in case you're among the automated yet annoyed like I was. Run the tasks as a different user. Here's how. Create a new user in Windows XP through Computer Management (Start > Setttings > Control Panel > Administrative Tools > Computer Management > Local Users and Groups). Open the Users folder and Right-click in the right pane to create a new user, and call the new user tasky or something like that. You'll probably need to add the new user to the administrative group depending on the type of scripts you run. You'll also need to set tasky's password, and uncheck the "User must change password at next logon" box. Click OK and tasky is born. Now go to the Task Scheduler and edit each of your tasks to run as [COMPUTER NAME]\tasky. Also be sure to uncheck the "Run only if logged on" box because tasky won't actually be logging into your machine anytime soon.
Now the helper scripts on my machine are running silently in the background—firing off email and assembling files—and I never have to know about it. (I know you lucky
One script grabs the current Amazon sales rank for a specific book and saves it in a CSV file. Another script grabs a mutual fund price from Yahoo! Finance and emails it to me. Another is simply a reminder script that sends me an email every Sunday afternoon saying, "Don't forget to send out ORblogs Weekly." All of the scripts are written in Perl.
So far so good. I'm automated. I'm informed. I'm being reminded of important things. But every time one of these little scripts runs, this pops up on my screen:
A blank command prompt. Argh. I'm writing away in Word, or writing an email, or posting to my blog and all of a sudden this black box pops up for three seconds while the script runs and then vanishes. There's no "run minimized" option in Windows Task Scheduler. (why not?) And there's no "run minimized" switch for Perl. (why not?) So today as the fifth black box made its appearance I lost it and decided to find a way to run these scripts minimized.
Here's the solution in case you're among the automated yet annoyed like I was. Run the tasks as a different user. Here's how. Create a new user in Windows XP through Computer Management (Start > Setttings > Control Panel > Administrative Tools > Computer Management > Local Users and Groups). Open the Users folder and Right-click in the right pane to create a new user, and call the new user tasky or something like that. You'll probably need to add the new user to the administrative group depending on the type of scripts you run. You'll also need to set tasky's password, and uncheck the "User must change password at next logon" box. Click OK and tasky is born. Now go to the Task Scheduler and edit each of your tasks to run as [COMPUTER NAME]\tasky. Also be sure to uncheck the "Run only if logged on" box because tasky won't actually be logging into your machine anytime soon.
Now the helper scripts on my machine are running silently in the background—firing off email and assembling files—and I never have to know about it. (I know you lucky
cron
people are probably laughing, but hey I'm not switching to Linux just for a better scheduler.)