opening

Regular reports of my grabber activity and that of others, plus information on QRSS software, hardware and technique that comes my way

Monday, June 4, 2012

Uploading Files Using DOS Commands

                             
Several months ago I found a somewhat hidden feature in Spectrum Lab which uses DOS commands in a simple batch file to directly upload grabs. I learned to use DOS commands and batch files years ago before there was Windows and the Internet so that's probably why I wasn't aware of the ftp DOS commands.  I haven't seen anyone describe it for QRSS grabbers so I'll report my experiences with it.

The programming consists of a few lines of code within SL and a few lines in a special file in the root directory,C:\.  Once it's working there's no need for a separate program such as Argo Uploader and it starts working as soon as SL is switched on.

Here's the two lines that go in the Periodic Actions page in SL:
-------------------------------------------
capture("C:\\ftp_upload\\SL1.jpg")
exec ("c:\\ftp_upload\\ftp_up.bat SL1.jpg")
-------------------------------------------
The first line makes the grab and stores it in the special folder in the root directory and the second line causes the batch file with the upload instructions to be executed and upload the file to my page at qsl.net.

The batch file and associated files are located in the folder c:\ftp_upload which contains the following files:

ftp_up.bat
ftpcmd.txt
ftplog.txt
SL1.jpg

Here's what the batch file, ftp_up.bat, looks like:
----------------------------------------
cd \ftp_upload

>> ftpcmd.txt echo USER user password

>> ftpcmd.txt echo binary

>> ftpcmd.txt echo put SL1.jpg

>> ftpcmd.txt echo disconnect

>> ftpcmd.txt ECHO bye

FTP  -n -s:ftpcmd.txt ftp.qsl.net > ftplog.txt

End
---------------------------------------

The files ftpcmd.txt and ftplog.txt are generated the first time the batch file runs so you don't have to worry about their content. SL1.jpg is the name of the grabbed image file that is expected by my page at qsl.net.  For the longer grabber it's 4Hr.jpg.

The first line in ftp_up.bat ensures we're in the directory with the file to be uploaded.  The other lines are standard DOS commands and the only thing you need to change is user and password in the next line and the ftp address of you web page in the next to last line.  Note that the USER in caps is part of the DOS ftp command and user is your username at your web site.  Otherwise it's not necessary to understand DOS command programming (which I barely do).

I actually have three versions of the batch uploader, one for each of my two grabbers and one to upload an "Off the Air" screen.  I simply name them ftp_upload1, 2 and 3. It's very versatile.

The only drawback to this method of uploading is that a small black cmd: screen pops up for a few seconds while it's uploading. If you find it annoying there's a way to suppress this screen but I'll save that procedure for a ps below.

Here is my Periodic Action Screen in Spectrum Lab:

Spectrum Lab Periodic Action Screen
The first line captures the screen for my storage folder and gives it a name like "SL04JUN12 1410z".
The second line captures it again with the name "SL1" just for upload purposes.
The third line executes the upload batch file.

DOS commands and batch files can be pretty tricky because of all the parameters and switches so if you have trouble I'll be glad to help.

de w4hbk

ps  How to suppress the black pop-up cmd: screen.

There is a Properties Box associated with the cmd: screen which can be invoked by right clicking on the bar at the top of the cmd: screen.  Since it stays on for only a few seconds it will be necessary to hit the "Pause" key to make it freeze so you have time to work, then "any key" to resume.  This doesn't actually suppress it but it reduces the size and moves it to a corner.  Change "Window Size" to 1 for both width and height and "Window Position" to move it to a corner.  As you change the numbers you'll see the changes in the "Window Preview".  It can actually be moved completely off screen by making one of the position numbers larger than the screen but I left mine as a tiny screen at the lower left so I'll be aware something is happening.  Maybe as I get more confident I'll move it totally off.




















1 comment: