Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::: RC8 Update! :::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::: Split out from SyncOlderPhotos.bat Sept 8th, 2022 :::
- ::: For reUsages with other things. see set vars below. :::
- ::: set vers=v7.9.7.64 20221104054808 by -JpE- :::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::: Runtime Display Module Copyright 2023 by -JpE- :::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- ::: <These vars must be set:>
- ::: set timethen=%time%
- ::: set datethen=%date%
- ::: <ASSURE ^ THESE ARE SET IN START OF ALL CALLERS!>
- set /a test21=(1)
- rem Have made untested changes that could fix it. 783 ???
- REM Seems to be a bug at Zulu hour, double zeros or such. It begins to manifest between Pause 1 and 2 with missing operator or something, then between 4 and 4b maybe as soon as 4a, then it becomes fatal somewhere after 8 and 9 somewhere which crashes the program until the bad or zulu numbers don't appear anymore. Once the missing operator (or whatever err that is) goes away, (time has passed) then it goes away and everything works fine again. Zulu hour definetly suspect, but unconfirmed. Check into the logic there. It might be as simple as replacing a " " or "" with a "0" or zero. (without the quotes)
- ::: Set test21 ^ to 7 for trace mode, else it's off.
- if not defined vers set vers=v8.7.0.09 20231106063912 by -JpE-
- :runtime
- echo %sl%
- echo Runtime Display Ultra Pro Deluxe 8
- echo %sl%
- echo %vers%
- echo %sl%
- echo .
- echo **%l1%**
- set calcdate=%date%
- set calctime=%time%
- ::: =====================[ NOW BEGIN ]=====================
- set "yearnow=%date:~0,4%"
- set /a yrn=(%yearnow%)
- :::
- set "montnow=%date:~5,2%"
- if "%montnow:~0,1%" equ " " set montnow=%montnow:~1,1%
- if "%montnow:~0,1%" equ "0" set montnow=%montnow:~1,1%
- if "%montnow%" equ "" set montnow=0
- set /a mtn=(%montnow%)
- :::
- set "daysnow=%date:~8,2%"
- if "%daysnow:~0,1%" equ " " set daysnow=%daysnow:~1,1%
- if "%daysnow:~0,1%" equ "0" set daysnow=%daysnow:~1,1%
- if "%daysnow%" equ "" set daysnow=0
- set /a dyn=(%daysnow%)
- if %test21% == 7 echo . & echo pause-1 & echo . & pause & echo .
- :::::::::::::::::::::::::::::::::
- ::: Hours | Minutes | Seconds :::
- :::::::::::::::::::::::::::::::::
- REM Tracking Zulu Hour Bugs... I think I got it v85!
- set "hournow=%time:~0,2%"
- if "%hournow:~0,1%" equ " " set hournow=%hournow:~1,1%
- if "%hournow:~0,1%" equ "0" set hournow=%hournow:~1,1%
- REM echo hournow == %hournow% & pause
- if "%hournow:~1,1%" equ " " set hournow="0"
- if "%hournow%" equ "" set hournow=0
- set /a hrn=(%hournow%)
- REM echo hournow == %hournow%, hrn == %hrn% & pause
- :::
- if %test21% == 7 echo . & echo pause-2 & echo . & pause & echo .
- set "minsnow=%time:~3,2%"
- if "%minsnow:~0,1%" equ " " set minsnow=%minsnow:~1,1%
- if "%minsnow:~0,1%" equ "0" set minsnow=%minsnow:~1,1%
- if "%minsnow:~1,1%" equ " " set minsnow="0"
- if "%minsnow%" equ "" set minsnow=0
- set /a min=(%minsnow%)
- :::
- if %test21% == 7 echo . & echo pause-2a & echo . & pause & echo .
- set "secsnow=%time:~6,2%"
- if "%secsnow:~0,1%" equ " " set secsnow=%secsnow:~1,1%
- if "%secsnow:~0,1%" equ "0" set secsnow=%secsnow:~1,1%
- if "%secsnow:~1,1%" equ " " set secsnow="0"
- if "%secsnow%" equ "" set secsnow=0
- set /a scn=(%secsnow%)
- :::
- if %test21% == 7 echo . & echo pause-2b & echo . & pause & echo .
- set "centinow=%time:~9,2%"
- if "%centinow:~0,1%" equ " " set centinow=%centinow:~1,1%
- if "%centinow:~0,1%" equ "0" set centinow=%centinow:~1,1%
- if "%centinow:~1,1%" equ " " set centinow="0"
- if "%centinow%" equ "" set centinow=0
- set /a mln=(%centinow%)
- if %test21% == 7 echo . & echo pause-3 & echo . & pause & echo .
- ::: =====================[ NOW END ]=====================
- ::: SUPER-PARSER DELUXE : PARSING EXAMPLE
- ::: =====================================================
- ::::::::::::::::::::::::[ THEN BEGIN ]:::::::::::::::::::::
- set "yearthen=%datethen:~0,4%"
- set /a yrt=(%yearthen%)
- :::
- set "montthen=%datethen:~5,2%"
- if "%montthen:~0,1%" equ " " set montthen=%montthen:~1,1%
- if "%montthen:~0,1%" equ "0" set montthen=%montthen:~1,1%
- if "%montthen%" equ "" set montthen=0
- set /a mtt=(%montthen%)
- if %test21% == 7 echo . & echo pause-4 & echo . & pause & echo .
- :::
- set "daysthen=%datethen:~8,2%"
- if "%daysthen:~0,1%" equ " " set daysthen=%daysthen:~1,1%
- if "%daysthen:~0,1%" equ "0" set daysthen=%daysthen:~1,1%
- if "%daysthen%" equ "" set daysthen=0
- set /a dyt=(%daysthen%)
- if %test21% == 7 echo . & echo pause-4a & echo . & pause & echo .
- :::
- set "hourthen=%timethen:~0,2%"
- if "%hourthen:~0,1%" equ " " set hourthen=%hourthen:~1,1%
- if "%hourthen:~0,1%" equ "0" set hourthen=%hourthen:~1,1%
- if "%hourthen:~1,1%" equ " " set hourthen="0"
- if "%hourthen%" equ "" set hourthen=0
- set /a hrt=(%hourthen%)
- if %test21% == 7 echo . & echo pause-5 & echo . & pause & echo .
- :::
- set "minsthen=%timethen:~3,2%"
- if "%minsthen:~0,1%" equ " " set minsthen=%minsthen:~1,1%
- if "%minsthen:~0,1%" equ "0" set minsthen=%minsthen:~1,1%
- if "%minsthen:~1,1%" equ " " set minsthen="0"
- if "%minsthen%" equ "" set minsthen=0
- set /a mit=(%minsthen%)
- :::
- set "secsthen=%timethen:~6,2%"
- if "%secsthen:~0,1%" equ " " set secsthen=%secsthen:~1,1%
- if "%secsthen:~0,1%" equ "0" set secsthen=%secsthen:~1,1%
- if "%secsthen:~1,1%" equ " " set secsthen="0"
- if "%secsthen%" equ "" set secsthen=0
- set /a sct=(%secsthen%)
- :::
- set "centithen=%timethen:~9,2%"
- if "%centithen:~0,1%" equ " " set centithen=%centithen:~1,1%
- if "%centithen:~0,1%" equ "0" set centithen=%centithen:~1,1%
- if "%centithen:~1,1%" equ " " set centithen="0"
- if "%centinow%" equ "" set centinow=0
- set /a mlt=(%centithen%)
- ::::::::::::::::::::::::[ THEN END ]:::::::::::::::::::::
- ::::::::::::::::::::::::::::::::::::::::::::
- ::: Days In Month aka dim, I know right. :::
- ::::::::::::::::::::::::::::::::::::::::::::
- set /a day=365
- set /a "mod=%yrn% %% 4%"
- if %mod% equ 0 set /a day=366
- set /a dim=31
- if %mtn% neq 2 goto notfeb
- ::: February regular or Leap Year!
- set /a dim=28
- if %mod% equ 0 set /a dim=29
- :notfeb
- ::: 30 days hath September, April, June, && November!!!
- ::: (all the rest have 31, except for february which
- ::: has 28, unless the year / 4 == whole-number,
- ::: in which case it's leap year & Feb has 29 days! (above) -ed
- if %mtn% equ 9 set /a dim=30
- if %mtn% equ 4 set /a dim=30
- if %mtn% equ 6 set /a dim=30
- if %mtn% equ 11 set /a dim=30
- :::::::::::::::::::::
- ::: Month as Word :::
- :::::::::::::::::::::
- set mt=January
- if %mtn% equ 2 set mt=February
- if %mtn% equ 3 set mt=March
- if %mtn% equ 4 set mt=April
- if %mtn% equ 5 set mt=May
- if %mtn% equ 6 set mt=June
- if %mtn% equ 7 set mt=July
- if %mtn% equ 8 set mt=August
- if %mtn% equ 9 set mt=September
- if %mtn% equ 10 set mt=October
- if %mtn% equ 11 set mt=November
- if %mtn% equ 12 set mt=December
- :::::::::::::::::::::::::::::::
- ::: Day of Week as a Word: :::
- :::::::::::::::::::::::::::::::
- set util2="%bats%\utility2.bat"
- if exist %util2% call %util2% dayOfWeek
- ::: Mod 20230718030330 v8.5.6.77 :::
- ::::::::::::::::::::::::::::::::::::
- if %test21% == 7 echo . & echo pause-6 & echo . & pause & echo .
- ::::::::::::::::::::::::::::::::::::
- ::: Partial Duplicate to Screen. :::
- ::::::::::::::::::::::::::::::::::::
- set ext=th
- set ned=th
- if %dyn% == 1 set ned=st
- if %dyn% == 21 set ned=st
- if %dyn% == 31 set ned=st
- if %mtn% == 1 set ext=st
- if %dyn% == 2 set ned=nd
- if %dyn% == 22 set ned=nd
- if %mtn% == 2 set ext=nd
- if %dyn% == 3 set ned=rd
- if %dyn% == 23 set ned=rd
- if %mtn% == 3 set ext=rd
- if %mod% == 0 set msg=IT'S LEAPYEAR!
- if %test21% == 7 echo . & echo pause-7 & echo . & pause & echo .
- ::: !!! R3 mods !!!
- set mlclc=%calctime:~9,2%
- if "%mlclc:~0,1%" equ " " set mlclc=%mlclc:~1,1%
- if "%mlclc:~0,1%" equ "0" set mlclc=%mlclc:~1,1%
- set /a mlclc=(%mlclc%)
- set nowtime=%time%
- ::: ^ for syncronization precision below.
- ::: strings to numbers...
- set mlnow=%nowtime:~9,2%
- if "%mlnow:~0,1%" equ " " set mlnow=%mlnow:~1,1%
- if "%mlnow:~0,1%" equ "0" set mlnow=%mlnow:~1,1%
- set /a mlnow=(%mlnow%)
- ::: Now Do the numerical calculations...
- set /a rtp=(%mlnow%-%mlclc%)
- if %rtp% lss 0 set /a rtp+=100
- ::: add -num is subtraction ^
- ::: Then our new numbers go back to padded strings!
- set rtpt=%rtp%
- if %rtp% leq 9 set "rtpt=0%rtpt%"
- ::: To display.
- echo **%sl% **
- echo **%l1%**
- ::: !!! revised RC8-v8.5.6.80 mods CONDENSED - REUSABLE !!!
- set strlen="%bats%\string_length.bat"
- set pads="%bats%\add_padding.bat"
- ::: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
- set line=It's %dayOfWeek% %mt% %daysnow%%ned%, %yearnow% @ %nowtime%
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- if %test21% == 7 echo . & echo pause-8 & echo . & pause & echo .
- ::: ^v extended uses of set line=bla & call %pads%
- set line=Processing Time was: 0.%rtpt% seconds on this System!
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- echo **%l1%**
- if %test21% == 7 echo . & echo pause-9 & echo . & pause & echo .
- :::
- set line=Program Started: %datethen% @ %timethen%
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- :::
- set line=Program Finish: %calcdate% @ %calctime%
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- echo **%l1%**
- :::
- set line=%mt% is the %mtn%%ext% month. %mt% has %dim% days.
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- :::
- REM if %test21% == 7 echo . & echo pause-9v & echo . & pause & echo .
- if %mod% equ 0 set line=%msg% & if exist %pads% if exist %strlen% call %pads% & echo **%l1%** & echo ** %line%**
- if %test21% == 7 echo . & echo pause-10 & echo . & pause & echo .
- ::: end R8 mods
- :::::::::::::::::::::::::::::::::::::
- :: Calculate how long it has been. ::
- :::::::::::::::::::::::::::::::::::::
- set /a centi=(%mln%-%mlt%)
- if %centi% lss 0 set /a scn-=1 & set /a "centi=(100+%centi%)"
- set /a secs=(%scn%-%sct%)
- if %secs% lss 0 set /a min-=1 & set /a "secs=(60+%secs%)"
- set /a mins=(%min%-%mit%)
- if %mins% lss 0 set /a hrn-=1 & set /a "mins=(60+%mins%)"
- set /a hour=(%hrn%-%hrt%)
- if %hour% lss 0 set /a dyn-=1 & set /a "hour=(24+%hour%)"
- set /a days=(%dyn%-%dyt%)
- if %days% lss 0 set /a mtn-=1 & set /a "days=(%dim%+%days%)"
- set /a mnth=(%mtn%-%mtt%)
- if %mnth% lss 0 set /a yrn-=1 & set /a "mnth=(12+%mnth%)"
- set /a year=(%yrn%-%yrt%)
- if %year% lss 0 set /a "year=0"
- if %test21% == 7 echo . & echo pause-11 & echo . & pause & echo .
- ::::::::::::::::::::::::::::::::::
- :: Check all values and Pad text
- ::::::::::::::::::::::::::::::::::
- if %year% lss 0 goto err
- set yrs=%year%
- if %year% lss 10 set yrs=0%year%
- ::
- if %mnth% lss 0 goto err
- if %mnth% gtr 12 goto err
- if %test21% == 7 echo . & echo pause-12 & echo . & pause & echo .
- set mts=%mnth%
- if %mnth% lss 10 set mts=0%mnth%
- ::
- if %days% lss 0 goto err
- if %days% gtr %dim% goto err
- set dys=%days%
- if %days% lss 10 set dys=0%days%
- ::
- if %hour% lss 0 goto err
- if %hour% gtr 23 goto err
- set hrs=%hour%
- if %hour% lss 10 set hrs=0%hour%
- ::
- if %mins% lss 0 goto err
- if %mins% gtr 59 goto err
- if %test21% == 7 echo . & echo pause-13 & echo . & pause & echo .
- set mns=%mins%
- if %mins% lss 10 set mns=0%mins%
- ::
- if %secs% lss 0 goto err
- if %secs% gtr 59 goto err
- set scs=%secs%
- if %secs% lss 10 set scs=0%secs%
- ::
- if %centi% lss 0 goto err
- if %centi% gtr 99 goto err
- set mli=%centi%
- if %centi% lss 10 set mli=0%centi%
- if %test21% == 7 echo . & echo pause-14 & echo . & pause & echo .
- ::::::::::::::::::::
- :: Log Code 7 ::
- ::::::::::::::::::::
- :: RESULTS CHECK ::
- ::::::::::::::::::::
- echo **%l1%**
- set line=Runtime Calculated with RunT-8.7.1
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- set line= ==================================
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line% **
- set line=%yrs% years, %mts% months, %dys% days,
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- set line=%hrs% hours, %mns% minutes, %scs%.%mli% seconds.
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- echo **%l1%**
- set line=Bye Bye For Now! Fare Well. Come Again. Adios!
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- echo **%l1%**
- echo .
- goto return
- :err
- echo **%l2%**
- set line=Error Detected, Please Review it.
- if exist %pads% if exist %strlen% call %pads%
- echo ** %line%**
- echo **%l2%**
- :: Programmatic pause for beta test user action.
- pause
- echo %l2%
- :return
- if %test21% == 7 echo Pause-END & pause
- exit /b %errorlevel%
- ::: 100% -JpE-
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement