OSDN Git Service

V208 corrected for line display with NOECHO
[fast-forth/master.git] / config / CopyTo_SD_Card.bat
1 ::CopyTo_SD_Card.bat
2 ::used by CopySourceFileToTarget_SD_Card.bat or by scite editor Tools menu
3
4 ::echo %2
5 ::echo %~d1\inc\%~n2.pat
6
7 @ECHO OFF
8
9 ::first select part .4th or .f
10
11 IF /I "%~x1" == ".4TH" GOTO 4th
12
13 :: ==============================================================================================
14 :: source file.f part
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)
20
21 IF "%~x1" == "" (
22 echo no file to be preprocessed!
23 goto badend
24 )
25
26 IF NOT EXIST %~dpn1.f (
27 echo %~dpn1.f not found!
28 goto badend
29 )
30
31 IF NOT EXIST %~d1\inc\%~n2.pat (
32 echo %~d1\inc\%~n2.pat not found!
33 goto badend
34 )
35
36 IF /I "%3" == "" GOTO preprocessF
37 IF /I "%3" == "ECHO" GOTO preprocessF
38 IF /I "%3" == "NOECHO" GOTO preprocessF
39 IF /I "%3" == "HALF" GOTO preprocessF
40
41 echo unexpected third parameter %3 !
42
43 :badend
44 pause > nul
45 exit
46
47
48 :preprocessF
49 ::@%~d1\prog\gema.exe -nobackup -line -t '\n=\r\n;\r\n=\r\n' -f  %~d1\inc\%~n2.pat %~dpn1.f %~dpn1.4th
50 @%~d1\prog\gema.exe -nobackup -line -t '-\r\n=\r\n' -f  %~d1\inc\%~n2.pat %~dpn1.f %~dpn1.4th
51
52 :DownloadF
53 @taskkill /F /IM ttermpro.exe 1> NUL 2>&1
54
55 :win32F
56 @"C:\Program Files\teraterm\ttpmacro.exe" /V %~d0\config\SendToSD.ttl %~dpn1.4th /C  1> NUL 2>&1
57 @IF NOT ERRORLEVEL 1 GOTO EndF
58
59 :win64F
60 @"C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~d0\config\SendToSD.ttl %~dpn1.4th /C
61
62 :EndF
63 @MOVE "%~dpn1.4th" "%~dp1\LAST.4th" > NUL
64 exit
65
66
67 :: ==============================================================================================
68 :: source file.4th part
69 :: %~dpn1.4th is the file to be sent described as drive\path\name.4th
70 :: %~d1 is the drive of param %1
71 :: %~nx0 is name.ext of this bat file
72
73 :4th
74
75 shift /2
76
77 ::echo %1
78 ::echo %2
79 ::echo %3
80 ::pause
81
82 IF NOT EXIST %~dpn1.4th (
83 echo %~dpn1.4th not found!
84 goto badend
85 )
86
87 if /I "%2"=="" GOTO Download4th
88 if /I "%2"=="ECHO" GOTO Download4th
89 if /I "%2"=="NOECHO" GOTO Download4th
90 if /I "%2"=="HALF" GOTO Download4th
91
92 echo unexpected 2th parameter %2 !
93 goto badend
94
95
96 :Download4th
97 @taskkill /F /IM ttermpro.exe 1> NUL 2>&1
98
99 :win324th
100 @"C:\Program Files\teraterm\ttpmacro.exe" /V %~d0\config\SendtoSD.ttl %~dpn1.4th /C 1> NUL 2>&1
101 @IF NOT ERRORLEVEL 1 GOTO End4th
102
103 :win644th
104 @"C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~d0\config\SendtoSD.ttl %~dpn1.4th /C
105
106 :End4th
107 @COPY "%~dpn1.4th" "%~dp1\LAST.4th" > NUL
108 exit
109