Miss The Olde Days...
Yeah, I know.
A few weeks ago I was wandering through one of the local home improvement stores. The owner is a right dick, and I use that term with great precision, as he is one of the few retailers who stands by that jackwad who sells his own pillows - and won't advertise on Faux Noise because they aren't as far out of the mainstream as he is.
Fortunately, that dick has moved quite a bit out of the sane lane, so I'm not particularly worried if he decides he wants to put himself up as a candidate for Gubbiner. It takes a real solid case of mental illness to complain about a system, then stick your head into the same system you say cheated a friend of yours - but it'll treat you right. Riiiiiiiiight.
Anywho, as in the background here roars Frankie Valli and The 4 Seasons with one of my all-time favorites - "Who Loves You". I'm a sucker for tight harmonies and songs that build from a quiet opening. That is, songs like Come Sail Away by Styx, Carry On My Wayward Son by Kansas, or one of my top favorites, Baba O'Reilly by The Who. Yeah, if you don't recognize it like that, you'd recognize "Teenage Wasteland" - that which they were decrying, not praising.
But as that aside slides away (and reminds me I really need to get a copy of The Who's Greatest Hits - I have some terrible holes in my music collection), I was in that home improvement store a few weeks ago and managed to wander past the clearance end cap over in the Electric section. That is, in the area where they have wire, lights, switches, and these days, they've expanded all the way out to Internet routers and cabling, along with some computer accessories. Including the odd webcam.
And when it's a $4.99 webcam from a brand I do not recognize, I'll take a chance. It has long been a dream of mine to point a camera out a window to take a shot every five to ten minutes or so, and upload it to my web site. Yeah, I know, I no longer have one of those, but I have dreams and plans. And it might, someday, happen, if I get lucky enough. Or if I keep working away. As they say.
But I miss the old days when I had access to a very smart hive mind. Fairly early on in the first incarnation of this site, I was "invited" to join a group of writers whom I deeply, greatly respected. And it was damned convenient to be able to ask some really bright folks "hey, what do you recommend for webcam software?"
I mean, I've finally reached a point where I'm almost old enough. As it were. I have a couple of external hard drives, I've got enough programming experience to be able to automate the system, either through batch files or other tools.
But what I really want to find is some freeware webcam software that will allow me to take pictures every so often - it shouldn't be difficult. Even if it's every 20 seconds or so, I can let it roll along, and I have tools which will allow me to drop the date and time into DOS Environment variables in order to use them in file names, etc.
Yeah, I know. I'm a real dork. But if you look at the output of both the date and time commands, they start with The. So here's the dirty little secret - create a batch file called "The.bat". Your first parameter will always be "current". Your second will be either date or time. The words.
What's that? Oh, the dirty trick. Here's the technical tips. First, at a command prompt, type "COPY CON ENTER.KSY" (the caps aren't strictly necessary) and hit Enter. Then hit enter a second time, and then press the CTRL key and Z. Then hit enter again. You've just created a file that is nothing but the enter key. Seriously.
Then we get to the fun part. I use the following command line:
Date < Enter.ksy > dstamp.bat
That is, the word Date, followed by the Less Than symbol, your new "Enter.ksy" file, the Greater Than symbol, and DStamp.bat. Technically, all you're doing is asking for the date. You don't need to change it, which DOS usually assumes you're intending to do because you called the command. So it wants you to do something, which we accomplish by feeding the Date command the Enter.ksy file. The Less Than symbol is a redirector - it tells the Date command to accept whatever the Enter.Ksy file tells it to do. Which means you've done the equivalent of pressing enter when the Date command asks you what you want the new date to be. We don't want it to change, we just want the output from the command.
And we direct the output from all of that into another file called DStamp.bat. Which is weird, right, because the Date command doesn't run another program... Until you create it. Then I have a second batch file, in the same folder, called "The.Bat."
Here's were we get really tricky. But first up, I can use that exact command whenever I'm in the right folder, because each time I run it, the single greater than symbol in front of DStamp.bat means "I don't care if there's one there, overwrite it. If it's not there, create it."
But what does that get me?
Well, the output of the command you called is a two-line file. It starts with "The current date is: DDD MM/DD/YYYY". That is, the first three Ds represent the day of the week. Then we have the month, day, and year - separated by slashes.
Which was where the problem started those many years ago. I was working for a company where I had to maintain a daily time sheet. If I was working on one task, I was working for that client - but then if I got a call, I needed to change the client I was working on. And I was pretty terrible about running out of paper sheets at the worst possible time, or forgetting to update when I switched, or ... Well, you get it. I've always been more of a keyboard guy. So when we started using Windows, I kept a command line open, and I'd flip to that and enter the command WT Client_name. And that WT batch file was a monster. It set an environmental variable with the client's name. And as I got more sophisticated, I could add up to sixty words noting what I was doing. And no, they didn't get dropped into environmental variables - that's a finite space, after all - but they did get dropped into a temporary file - then I would use the The.Bat file. It was sneaky.
@ECHO OFF
REM THE.BAT
REM DATE AND TIME PARSER
IF %1!==! GOTO :NOPARAM
IF %2!==date! GOTO :DATESTAMP
IF %2!==Date! GOTO :DATESTAMP
IF %2!==time! GOTO :TIMESTAMP
IF %2!==Time! GOTO :TIMESTAMP
GOTO :UNKNOWN
:DATESTAMP
DATEFMT %5 > SETNOWDATE.BAT
CALL SETNOWDATE
GOTO :DOOR
:TIMESTAMP
TIMEFMT %5 > SETNOWTIME.BAT
CALL SETNOWTIME
GOTO :DOOR
:NOPARAM
ECHO This Needs Parameters. Failed.
GOTO :DOOR
:UNKNOWN
ECHO Whatever parameter you passed did not work. Sorry.
:DOOR
Yeah, all off the top of my head. I *am* scary like that. The DATEFMT and TIMEFMT programs were quick and dirty little programs I had written in Pascal at the time. They ate the date or time as submitted, and the date simply re-ordered the date to YYYY-MM-DD so I could drop the data in a spreadsheet (back when we were all using Quattro Pro) and sort. The Time converted from AM/PM to military time for the same reasons.
So, yeah. Then I learned - this very day - a neat little trick that now works at the command line.
ECHO %date:~10,4%%date:4,2%%date7,2%
That neat little bit of typing does a neat little trick with what is now the date environment variable. Ain't that wonderful what they've gone and done that I had to do with a sledgehammer and lots of chisels?
Oh, wait, I should explain. If you go to a command prompt and type ECHO %DATE% (the case is irrelevant), you're telling the computer "please show me the value of the variable DATE." That's what the percent marks do on either side. And that long echo line above tells it "please echo the variable date, starting ten characters in, the next four, then four characters in, the next two, then seven characters in, those two." It's called parsing the string. Yeah, it's a fancy little technical term we used. And there you get a date which comes out YYYYMMDD because your date is the three character day of the week, a space, the two character month, a slash, two character day, another slash, and four character year - at least, that is how it is in the United States using the default date format.
But we've steered way the hell of the original path, so I guess to get back to it, I'm looking for some basic web cam software - nothing fancy - that will allow me to take regularly-timed snapshots and save them on the computer. Ideally, I can set the name of the file as "picture.jpg" or whatever, and then I can set up an automated process that will, on a regular basis, copy that file from "picture.jpg" to something I'd probably call "IMG_YYYYMMDD_HHMMSS.jpg" and store it in another folder. Then I'd copy it from there to the server, where it would be called "picture.jpg" so it would replace the picture already there. Yeah, I'm a low-tech sort of fellow. But it would be fun.
Anyway, I'll have to do my own research and dig deep, figure out what works, and ... make it work. Because I can most likely get it to work. I think.
And you have a wonderful rest of your weekend as well.
Comments
Post a Comment