Have been using 4DOS/TCC since days of downloading beta versions of 4DOS from Channel One BBS but has been awhile since I wrote more than a few lines of code for a CMD and am obviously a bit rusty.
I need help. Obviously Rex and his staff do not have the time to proofread and correct folks' BAT files but perhaps some other TCC aficionados might.
First the particulars:
TCC 12.11.76 Windows Vista [Version 6.0.6001]
TCC Build 76 Windows Vista Build 6001 Service Pack 1
3 windows open on desktop: TCC, Windows Explorer, iSpy.
Utilizing an older laptop with not enough disk space in system partition for service pack 2. I have serious doubts that using Service Pack 1 is the problem, but anything is possible. Please advise. I will change laptops but would prefer NOT to do so.
With a security camera, I am conducting an initial experiment with time-lapse photography as well as sharing with friends on a web site (http://www.webafterfive.com/garden/). I FTP a pic to the website and have an external hard drive storing the pic taken by iSpy (http://www.ispyconnect.com).
The CMD file below is the engine that runs this train. Essentially a pic (SNAP.JPG) is renamed according to time and date, uploaded to website, and saved to either 1 or 2 directories. Then the CMD file waits until another pic is created and the process repeats.
The problem is that the CMD kicks out to the command prompt sporadically. It has run for more than 2 weeks continuously, down to literally a matter of minutes. Then more than a week then less than a day and seemingly all points in between.
I cannot figure out why. Can you?
I welcome all comments, and I am sure there are more "elegant" ways to accomplish what I am doing. Feel free to point these out if you wish, but I am most interested in solving the problem of the CMD file kicking out to the prompt. It is probably something very simple that I just am unable to see. Thanks in advance.
-------------------------
setlocal
gosub NEWSCREEN
rem **SET PICTURE COUNTER
set x=0
rem **SET ARCHIVE DIRECTORIES
set homedir="I:\gardenpics\%@instr[0,8,%_datetime]"
set hourhomedir="I:\gardenpics\hourly\%@instr[0,8,%_datetime]"
rem **SET MIDNIGHT HOUR FOR NEW DAY DIRECTORY CREATION
set midnitehour=0
rem **SET FIRSTRUN MARKER
set firstrun=1
rem **SET NEW DAY MARKER
set newday=1
rem ** INITIAL SET HOUR COUNTERS AND ARCHIVE MARKERS
set t0hour=0
set t1hour=1
set t2hour=2
set t3hour=3
set t4hour=4
set t5hour=5
set t6hour=6
set t7hour=7
set t8hour=8
set t9hour=9
set t10hour=10
set t11hour=11
set t12hour=12
set t13hour=13
set t14hour=14
set t15hour=15
set t16hour=16
set t17hour=17
set t18hour=18
set t19hour=19
set t20hour=20
set t21hour=21
set t22hour=22
set t23hour=23
set a0hourarc=0
set a1hourarc=0
set a2hourarc=0
set a3hourarc=0
set a4hourarc=0
set a5hourarc=0
set a6hourarc=0
set a7hourarc=0
set a8hourarc=0
set a9hourarc=0
set a10hourarc=0
set a11hourarc=0
set a12hourarc=0
set a13hourarc=0
set a14hourarc=0
set a15hourarc=0
set a16hourarc=0
set a17hourarc=0
set a18hourarc=0
set a19hourarc=0
set a20hourarc=0
set a21hourarc=0
set a22hourarc=0
set a23hourarc=0
:BEGIN
rem **SET ERRORLEVELs
set newpic=1
set ftplogon=1
set cpypic=1
rem **LOOP UNTIL SNAP.JPG EXIST
if NOT exist "G:\Ispy\video\Garden\grabs\snap.jpg" goto :END
move /Q G:\Ispy\video\Garden\grabs\snap.jpg
rem **CHECK MOVE IF NOT SUCCESS START OVER
set newpic=%_?
if %newpic!=0 goto :END
rem **IFTP SESSION TO GODADDY.COM
iftp /P1 /Q "ftp://(actual name/password/location goes here)"
rem **CHECK IFTP IF NOT SUCCESS START OVER
set ftplogon=%_?
if %ftplogon!=0 goto :ENDIFTP
gosub :NEWSCREEN
copy /Q snap.jpg "ftp:"
rem **CHECK COPY IF NOT SUCCESS START OVER
set cpypic=%_?
if %cpypic!=0 goto :END
set /a x=x+1
gosub :NEWSCREEN
rem **THREE CYCLES TO GIVE TIME TO SEMI-SYNC WITH ISPY. COUNT TO SCREEN.
if %x gt 3 echo %x copies of SNAP.JPG sent to WAF.
rem **CHECK FOR MIDNIGHT HOUR or FIRST TIME RUN, NEW HOMEDIR AND NEW HOURHOMEDIR
iff %_hour==%midnitehour .or. %firstrun==1 then
set homedir="I:\gardenpics\%@instr[0,8,%_datetime]"
if not isdir %homedir md %homedir
set hourhomedir="I:\gardenpics\hourly\%@instr[0,8,%_datetime]"
if not isdir %hourhomedir md %hourhomedir
set firstrun=0
endiff
rem **RESET HOURLY ARCHIVE MARKERS AND NEW DAY
iff %_hour==%midnitehour .and. %newday==1 then
set a0hourarc=0
set a1hourarc=0
set a2hourarc=0
set a3hourarc=0
set a4hourarc=0
set a5hourarc=0
set a6hourarc=0
set a7hourarc=0
set a8hourarc=0
set a9hourarc=0
set a10hourarc=0
set a11hourarc=0
set a12hourarc=0
set a13hourarc=0
set a14hourarc=0
set a15hourarc=0
set a16hourarc=0
set a17hourarc=0
set a18hourarc=0
set a19hourarc=0
set a20hourarc=0
set a21hourarc=0
set a22hourarc=0
set a23hourarc=0
set newday=0
endiff
rem **ARCHIVE SNAP.JPG
:ARCHIVESNAP
set arcfile=garden%_datetime.jpg
copy /Q snap.jpg "%homedir\%arcfile"
rem **ARCHIVE HOURLY SNAP.JPG
iff %_hour==%t0HOUR .and. %a0HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a0HOURARC=1
elseiff %_hour==%t1HOUR .and. %a1HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a1HOURARC=1
elseiff %_hour==%t2HOUR .and. %a2HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a2HOURARC=1
elseiff %_hour==%t3HOUR .and. %a3HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a3HOURARC=1
elseiff %_hour==%t4HOUR .and. %a4HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a4HOURARC=1
elseiff %_hour==%t5HOUR .and. %a5HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a5HOURARC=1
elseiff %_hour==%t6HOUR .and. %a6HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a6HOURARC=1
elseiff %_hour==%t7HOUR .and. %a7HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a7HOURARC=1
elseiff %_hour==%t8HOUR .and. %a8HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a8HOURARC=1
elseiff %_hour==%t9HOUR .and. %a9HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a9HOURARC=1
elseiff %_hour==%t10HOUR .and. %a10HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a10HOURARC=1
elseiff %_hour==%t11HOUR .and. %a11HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a11HOURARC=1
elseiff %_hour==%t12HOUR .and. %a12HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a12HOURARC=1
elseiff %_hour==%t13HOUR .and. %a13HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a13HOURARC=1
elseiff %_hour==%t14HOUR .and. %a14HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a14HOURARC=1
elseiff %_hour==%t15HOUR .and. %a15HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a15HOURARC=1
elseiff %_hour===%t16HOUR .and. %a16HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a16HOURARC=1
elseiff %_hour==%t17HOUR .and. %a17HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a17HOURARC=1
elseiff %_hour==%t18HOUR .and. %a18HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a18HOURARC=1
elseiff %_hour==%t19HOUR .and. %a19HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a19HOURARC=1
elseiff %_hour==%t20HOUR .and. %a20HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a20HOURARC=1
elseiff %_hour==%t21HOUR .and. %a21HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a21HOURARC=1
elseiff %_hour==%t22HOUR .and. %a22HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a22HOURARC=1
elseiff %_hour==%t23HOUR .and. %a23HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
iff %cpypic==0 then
set a23HOURARC=1
set newday=1
endiff
endiff
rem **REMOVE SNAP.JPG
del /K /Q snap.jpg
:ENDIFTP
iftp /c
rem **THREE CYCLES TO GIVE TIME TO SEMI-SYNC WITH ISPY
if %x gt 3 delay 12
:END
delay 1
goto :BEGIN
endlocal
quit
rem **SUBROUTINES
:NEWSCREEN
cls
echo.
echo.
return
I need help. Obviously Rex and his staff do not have the time to proofread and correct folks' BAT files but perhaps some other TCC aficionados might.
First the particulars:
TCC 12.11.76 Windows Vista [Version 6.0.6001]
TCC Build 76 Windows Vista Build 6001 Service Pack 1
3 windows open on desktop: TCC, Windows Explorer, iSpy.
Utilizing an older laptop with not enough disk space in system partition for service pack 2. I have serious doubts that using Service Pack 1 is the problem, but anything is possible. Please advise. I will change laptops but would prefer NOT to do so.
With a security camera, I am conducting an initial experiment with time-lapse photography as well as sharing with friends on a web site (http://www.webafterfive.com/garden/). I FTP a pic to the website and have an external hard drive storing the pic taken by iSpy (http://www.ispyconnect.com).
The CMD file below is the engine that runs this train. Essentially a pic (SNAP.JPG) is renamed according to time and date, uploaded to website, and saved to either 1 or 2 directories. Then the CMD file waits until another pic is created and the process repeats.
The problem is that the CMD kicks out to the command prompt sporadically. It has run for more than 2 weeks continuously, down to literally a matter of minutes. Then more than a week then less than a day and seemingly all points in between.
I cannot figure out why. Can you?
I welcome all comments, and I am sure there are more "elegant" ways to accomplish what I am doing. Feel free to point these out if you wish, but I am most interested in solving the problem of the CMD file kicking out to the prompt. It is probably something very simple that I just am unable to see. Thanks in advance.
-------------------------
setlocal
gosub NEWSCREEN
rem **SET PICTURE COUNTER
set x=0
rem **SET ARCHIVE DIRECTORIES
set homedir="I:\gardenpics\%@instr[0,8,%_datetime]"
set hourhomedir="I:\gardenpics\hourly\%@instr[0,8,%_datetime]"
rem **SET MIDNIGHT HOUR FOR NEW DAY DIRECTORY CREATION
set midnitehour=0
rem **SET FIRSTRUN MARKER
set firstrun=1
rem **SET NEW DAY MARKER
set newday=1
rem ** INITIAL SET HOUR COUNTERS AND ARCHIVE MARKERS
set t0hour=0
set t1hour=1
set t2hour=2
set t3hour=3
set t4hour=4
set t5hour=5
set t6hour=6
set t7hour=7
set t8hour=8
set t9hour=9
set t10hour=10
set t11hour=11
set t12hour=12
set t13hour=13
set t14hour=14
set t15hour=15
set t16hour=16
set t17hour=17
set t18hour=18
set t19hour=19
set t20hour=20
set t21hour=21
set t22hour=22
set t23hour=23
set a0hourarc=0
set a1hourarc=0
set a2hourarc=0
set a3hourarc=0
set a4hourarc=0
set a5hourarc=0
set a6hourarc=0
set a7hourarc=0
set a8hourarc=0
set a9hourarc=0
set a10hourarc=0
set a11hourarc=0
set a12hourarc=0
set a13hourarc=0
set a14hourarc=0
set a15hourarc=0
set a16hourarc=0
set a17hourarc=0
set a18hourarc=0
set a19hourarc=0
set a20hourarc=0
set a21hourarc=0
set a22hourarc=0
set a23hourarc=0
:BEGIN
rem **SET ERRORLEVELs
set newpic=1
set ftplogon=1
set cpypic=1
rem **LOOP UNTIL SNAP.JPG EXIST
if NOT exist "G:\Ispy\video\Garden\grabs\snap.jpg" goto :END
move /Q G:\Ispy\video\Garden\grabs\snap.jpg
rem **CHECK MOVE IF NOT SUCCESS START OVER
set newpic=%_?
if %newpic!=0 goto :END
rem **IFTP SESSION TO GODADDY.COM
iftp /P1 /Q "ftp://(actual name/password/location goes here)"
rem **CHECK IFTP IF NOT SUCCESS START OVER
set ftplogon=%_?
if %ftplogon!=0 goto :ENDIFTP
gosub :NEWSCREEN
copy /Q snap.jpg "ftp:"
rem **CHECK COPY IF NOT SUCCESS START OVER
set cpypic=%_?
if %cpypic!=0 goto :END
set /a x=x+1
gosub :NEWSCREEN
rem **THREE CYCLES TO GIVE TIME TO SEMI-SYNC WITH ISPY. COUNT TO SCREEN.
if %x gt 3 echo %x copies of SNAP.JPG sent to WAF.
rem **CHECK FOR MIDNIGHT HOUR or FIRST TIME RUN, NEW HOMEDIR AND NEW HOURHOMEDIR
iff %_hour==%midnitehour .or. %firstrun==1 then
set homedir="I:\gardenpics\%@instr[0,8,%_datetime]"
if not isdir %homedir md %homedir
set hourhomedir="I:\gardenpics\hourly\%@instr[0,8,%_datetime]"
if not isdir %hourhomedir md %hourhomedir
set firstrun=0
endiff
rem **RESET HOURLY ARCHIVE MARKERS AND NEW DAY
iff %_hour==%midnitehour .and. %newday==1 then
set a0hourarc=0
set a1hourarc=0
set a2hourarc=0
set a3hourarc=0
set a4hourarc=0
set a5hourarc=0
set a6hourarc=0
set a7hourarc=0
set a8hourarc=0
set a9hourarc=0
set a10hourarc=0
set a11hourarc=0
set a12hourarc=0
set a13hourarc=0
set a14hourarc=0
set a15hourarc=0
set a16hourarc=0
set a17hourarc=0
set a18hourarc=0
set a19hourarc=0
set a20hourarc=0
set a21hourarc=0
set a22hourarc=0
set a23hourarc=0
set newday=0
endiff
rem **ARCHIVE SNAP.JPG
:ARCHIVESNAP
set arcfile=garden%_datetime.jpg
copy /Q snap.jpg "%homedir\%arcfile"
rem **ARCHIVE HOURLY SNAP.JPG
iff %_hour==%t0HOUR .and. %a0HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a0HOURARC=1
elseiff %_hour==%t1HOUR .and. %a1HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a1HOURARC=1
elseiff %_hour==%t2HOUR .and. %a2HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a2HOURARC=1
elseiff %_hour==%t3HOUR .and. %a3HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a3HOURARC=1
elseiff %_hour==%t4HOUR .and. %a4HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a4HOURARC=1
elseiff %_hour==%t5HOUR .and. %a5HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a5HOURARC=1
elseiff %_hour==%t6HOUR .and. %a6HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a6HOURARC=1
elseiff %_hour==%t7HOUR .and. %a7HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a7HOURARC=1
elseiff %_hour==%t8HOUR .and. %a8HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a8HOURARC=1
elseiff %_hour==%t9HOUR .and. %a9HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a9HOURARC=1
elseiff %_hour==%t10HOUR .and. %a10HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a10HOURARC=1
elseiff %_hour==%t11HOUR .and. %a11HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a11HOURARC=1
elseiff %_hour==%t12HOUR .and. %a12HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a12HOURARC=1
elseiff %_hour==%t13HOUR .and. %a13HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a13HOURARC=1
elseiff %_hour==%t14HOUR .and. %a14HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a14HOURARC=1
elseiff %_hour==%t15HOUR .and. %a15HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a15HOURARC=1
elseiff %_hour===%t16HOUR .and. %a16HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a16HOURARC=1
elseiff %_hour==%t17HOUR .and. %a17HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a17HOURARC=1
elseiff %_hour==%t18HOUR .and. %a18HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a18HOURARC=1
elseiff %_hour==%t19HOUR .and. %a19HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a19HOURARC=1
elseiff %_hour==%t20HOUR .and. %a20HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a20HOURARC=1
elseiff %_hour==%t21HOUR .and. %a21HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a21HOURARC=1
elseiff %_hour==%t22HOUR .and. %a22HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
if %cpypic==0 set a22HOURARC=1
elseiff %_hour==%t23HOUR .and. %a23HOURARC==0 then
copy /Q snap.jpg "%hourhomedir\%arcfile"
set cpypic=%_?
iff %cpypic==0 then
set a23HOURARC=1
set newday=1
endiff
endiff
rem **REMOVE SNAP.JPG
del /K /Q snap.jpg
:ENDIFTP
iftp /c
rem **THREE CYCLES TO GIVE TIME TO SEMI-SYNC WITH ISPY
if %x gt 3 delay 12
:END
delay 1
goto :BEGIN
endlocal
quit
rem **SUBROUTINES
:NEWSCREEN
cls
echo.
echo.
return