[Show/Hide Left Column]

s_Timestamp_Adjustment

::Timestamp Adjustment using ZDate

:: ===================================================================================
:: Purpose:         Adjust timestamp of current file or all tagged files.
:: Author:          John Gruener
:: Version:         1.11, 2007-08-19
:: ZTW Version:     1.61 or later
:: O/S Version:     Windows 98, 2K, XP (no known tests in Vista).
:: Requires:        ZD.EXE ver. 1.10a or later, by Kim Henkel (ZedTek).
::   Source:          http://www.zedtek.com/download/zd.zip
:: Requires:        CHOICE.EXE ver. 1.5 or later, by Walt Pattinson (WildeWare).
::   Source:          http://www.ztwiki.com/tiki-index.php?page=u_Choice
:: Usage:           Follow the prompts.
:: Notes:           ZD.EXE and CHOICE.EXE are coded to be in the ZTree Tools directory.
::                  No syntax checking is done prior to calling ZD.EXE.
::                  CHOICE.EXE permits [Enter] for the default or [Esc] to cancel.
::                  (Comments are included to help explain how an
::                  F9 script is made to operate on tagged files.)
:: CAUTION:         Default responses are set to [Y].
:: History:         1.11 - Removed unnecessary double percents, changed "" to [].
::                  1.10 - Changed location of ZD and CHOICE from ZTHome to ZTTools.
::                  1.01 - Corrected author of CHOICE.EXE & changed download location.
:: ===================================================================================

:: Test to see if this generated ZTW_MENU.BAT file is being called (re-entered)
:: by the next line in the generated ZTW_CALL.BAT file:
IF [%%1]==[NEXT] GOTO NextFile

:: Use #ZTSet to prompt for timestamp adjustment and store in variable ZDAdj:
REM #ZTSet ZDAdj Enter adjustment (e.g., +1h, -1h, /E) [Help]...

:: Check for exit or help:
IF [%ZDAdj%]==[q] GOTO End
IF [%ZDAdj%]==[Q] GOTO End
IF [%ZDAdj%]==[x] GOTO End
IF [%ZDAdj%]==[X] GOTO End
IF [%ZDAdj%]==[h] GOTO Syntax
IF [%ZDAdj%]==[H] GOTO Syntax
IF [%ZDAdj%]==[?] GOTO Syntax
IF [%ZDAdj%]==[]  GOTO Syntax

:: Test to see if we're in a Directory Window:
SET ZTDir=0
REM #ZTIfDir SET ZTDir=1
IF [%ZTDir%]==[0] GOTO ChkTags
ECHO.
ECHO    ZTree must be in a File Window.
GOTO Pause

:ChkTags
:: Test for the presence of tags:
SET ZTTags=0
REM #ZTIfTagged SET ZTTags=1
IF [%ZTTags%]==[1] GOTO Tags

:NoTags
ECHO.
ECHO    No tagged files in the current File Window.
ECHO.
"#ZTTools\CHOICE.EXE" /E /N "   Apply %ZDAdj% adjustment to current file? [Y], N..."
IF ERRORLEVEL 2 GOTO End
:: Use ECHO to create the ZTW_CALL.BAT file for the current (untagged) file:
ECHO CALL "#ZTTemp\ZTW_MENU.BAT" NEXT %1 >"#ZTTemp\ZTW_CALL.BAT"
GOTO Call

:Tags
ECHO.
ECHO    Tagged files detected.
ECHO.
"#ZTTools\CHOICE.EXE" /E /N "   Apply %ZDAdj% adjustment to all tagged files? [Y], N..."
IF ERRORLEVEL 2 GOTO End
:: Use #ZTTag to create the ZTW_CALL.BAT file for all tagged files:
REM #ZTTag "#ZTTemp\ZTW_CALL.BAT" -fCALL "#ZTTemp\ZTW_MENU.BAT" NEXT %1

:Call
:: Call the generated ZTW_CALL.BAT file to process the current file or
:: all tagged files, then pause with a message when it returns:
ECHO.
CALL "#ZTTemp\ZTW_CALL.BAT"
GOTO Pause

:Syntax
ECHO.
ECHO.   The adjustment syntax is:
ECHO.
ECHO.       +#x  or -#x
ECHO.
ECHO.   # = Amount of adjustment
ECHO.
ECHO.   x =
ECHO.       d = Day
ECHO.       m = Month
ECHO.       y = Year
ECHO.       h = Hour
ECHO.       n = miNute
ECHO.       s = Second
ECHO.
ECHO.   Adjustments may be combined:
ECHO.
ECHO.       -1y+3d-4h
ECHO.
ECHO.   Adjust times up to even seconds:
ECHO.
ECHO.       /E

:Pause
ECHO.
ECHO.   Press any key to close...
PAUSE >NUL
GOTO End

:NextFile
:: Re-entry point from ZTW_CALL.BAT to process
:: the current untagged file or next tagged file:
ECHO Adjusting %%2
"#ZTTools\ZD.EXE" %ZDAdj% %%2

:End


Contributors to this page: JohnG .
Page last modified on Sunday 19 of August, 2007 10:39:08 EDT by JohnG.