2 ::used by SendSourceFileToTarget.bat or by scite editor Tools menu
5 ::echo %~dp1..\inc\%~n2.pat
9 ::first select part .4TH or .f
11 IF /I "%~x1" == ".4TH" GOTO 4TH
13 :: ==============================================================================================
15 :: %~dpn1.f is the symbolic source file.f described as drive\path\name.f
16 :: %~d1\inc\%~n2.pat is the pattern file for preprocessor gema.exe
17 :: %~dpn1.4TH is the source file.4TH to be sent to the target
18 :: %~d1 is the drive of arg %1
19 :: %~n2 is your selected template by SelectTarget.bat or your scite $(1)
27 echo no file to be preprocessed!
31 IF NOT EXIST %~dpn1.f (
32 echo %~dpn1.f not found!
36 IF NOT EXIST %~dp1..\inc\%~n2.pat (
37 echo %~dp1..\inc\%~n2.pat not found!
41 IF /I "%3" == "" GOTO preprocessF
42 IF /I "%3" == "ECHO" GOTO preprocessF
43 IF /I "%3" == "NOECHO" GOTO preprocessF
44 IF /I "%3" == "HALF" GOTO preprocessF
46 echo unexpected third parameter %3 !
54 @%~d1\prog\gema.exe -nobackup -line -t '-\r\n=\r\n' -f %~dp1..\inc\%~n2.pat %~dpn1.f %~dpn1.4TH
55 @call %~d1\config\Select.bat SelectDeviceId %~dp1..\inc\%~n2.pat
58 @taskkill /F /IM ttermpro.exe 1> NUL 2>&1
61 @"C:\Program Files\teraterm\ttpmacro.exe" /V %~d1\config\SendFile.ttl %~dpn1.4TH /C %3 %deviceid% 1> NUL 2>&1
62 @IF NOT ERRORLEVEL 1 GOTO EndF
65 @"C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~d1\config\SendFile.ttl %~dpn1.4TH /C %3 %deviceid%
68 @MOVE "%~dpn1.4TH" "%~dp1LAST.4TH" > NUL
69 call %~d1\config\Select.bat SelectDevice %~dp1..\inc\%~n2.pat
70 if not exist %~dp1SD_%device:~3% MD %~dp1SD_%device:~3% > NUL
71 COPY /y %~dp1LAST.4TH %~dp1SD_%device:~3%\%~n1.4TH > NUL
75 :: ==============================================================================================
76 :: source file.4TH part
77 :: %~dpn1.4TH is the file to be sent described as drive\path\name.4TH
78 :: %~d1 is the drive of param %1
79 :: %~nx0 is name.ext of this bat file
90 IF NOT EXIST %~dpn1.4TH (
91 echo %~dpn1.4TH not found!
95 if /I "%2"=="" GOTO Download4th
96 if /I "%2"=="ECHO" GOTO Download4th
97 if /I "%2"=="NOECHO" GOTO Download4th
98 if /I "%2"=="HALF" GOTO Download4th
100 echo unexpected 2th parameter %2 !
106 @taskkill /F /IM ttermpro.exe 1> NUL 2>&1
109 @"C:\Program Files\teraterm\ttpmacro.exe" /V %~d1\config\SendFile.ttl %~dpn1.4TH /C %2 0 1> NUL 2>&1
110 @IF NOT ERRORLEVEL 1 GOTO End4th
113 @"C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~d1\config\SendFile.ttl %~dpn1.4TH /C %2 0
116 @COPY "%~dpn1.4TH" "%~dp1LAST.4TH" > NUL