OSDN Git Service

la der de der
[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 %~dp1..\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 :: %~dp0 is the path of this file.bat
16 :: %~dpn1.f is the symbolic source file.f described as drive\path\name.f
17 :: %~d1\inc\%~n2.pat is the pattern file for preprocessor gema.exe
18 :: %~dpn1.4TH is the source file.4TH to be sent to the target
19 :: %~d1 is the drive of arg %1
20 :: %~n2 is your selected template by SelectTarget.bat or your scite $(1)
21
22 ::echo %1
23 ::echo %2
24 ::echo %3
25 ::pause
26
27 IF "%~x1" == "" (
28 echo no file to be preprocessed!
29 goto badend
30 )
31
32 IF NOT EXIST %~dpn1.f (
33 echo %~dpn1.f not found!
34 goto badend
35 )
36
37 IF NOT EXIST %~dp0..\inc\%~n2.pat (
38 echo %~dp0..\inc\%~n2.pat not found!
39 goto badend
40 )
41
42 IF /I "%3" == "" GOTO preprocessF
43
44 echo unexpected third parameter %3 !
45
46 :badend
47 pause > nul
48 exit
49
50
51 :preprocessF
52 %~dp0..\prog\gema.exe -nobackup -line -t '-\r\n=\r\n' -f  %~dp0..\inc\%~n2.pat %~dpn1.f %~dpn1.4TH
53 call  %~dp0Select.bat SelectDeviceId %~dp0..\inc\%~n2.pat
54
55 :DownloadF
56 taskkill /F /IM ttermpro.exe 1> NUL 2>&1
57
58 :win32F
59 "C:\Program Files\teraterm\ttpmacro.exe" /V %~dp0SendToSD.ttl %~dpn1.4TH /C %deviceid% 1> NUL 2>&1
60 IF NOT ERRORLEVEL 1 GOTO EndF
61
62 :win64F
63 "C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~dp0SendToSD.ttl %~dpn1.4TH /C %deviceid%
64
65 :EndF
66 MOVE "%~dpn1.4TH" "%~dp1LAST.4TH" > NUL
67 exit
68
69
70 :: ==============================================================================================
71 :: source file.4TH part
72 :: %~dp0 is the path of this file.bat
73 :: %~dpn1.4TH is the file to be sent described as drive\path\name.4TH
74 :: %~d1 is the drive of param %1
75 :: %~nx0 is name.ext of this bat file
76
77 :4TH
78
79 shift /2
80
81 ::echo %1
82 ::echo %2
83 ::echo %3
84 ::pause
85
86 IF NOT EXIST %~dpn1.4TH (
87 echo %~dpn1.4TH not found!
88 goto badend
89 )
90
91 if /I "%2"=="" GOTO Download4th
92
93 echo unexpected 2th parameter %2 !
94 goto badend
95
96
97 :Download4th
98 taskkill /F /IM ttermpro.exe 1> NUL 2>&1
99
100 :win324th
101 "C:\Program Files\teraterm\ttpmacro.exe" /V %~dp0SendtoSD.ttl %~dpn1.4TH /C 0 1> NUL 2>&1
102 IF NOT ERRORLEVEL 1 GOTO End4th
103
104 :win644th
105 "C:\Program Files (x86)\teraterm\ttpmacro.exe" /V %~dp0SendtoSD.ttl %~dpn1.4TH /C 0
106
107 :End4th
108 exit
109