1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
-
|
|
|
!
| #include "hspext.as" #addition "dirlist2.hsp"
#packopt name "不要ファイル削除"
#packopt hide 1
#define PROGRAM_NAME "不要ファイル削除"
#define DATAFILE "save.dat"
#enum MAIN_SCREEN = 0 #const WINX 480 #const WINY 280 #const TAB 30
#const MARGIN_X 20 #const MARGIN_Y 15 #const BUTTON_X 80 #const BUTTON_Y 22 #const FRAME 180 #const FILETYPE_MAX 4 #const LINE_BREAK 4 #const SEPARATE 20
gosub *SET_VAR gosub *DATA_LOAD gosub *MAKE_SCREEN gosub *SET_OBJECT
gsel MAIN_SCREEN, 1
onexit goto *END_PROGRAM
stop
*SET_VAR
sdim fileName, 20, FILETYPE_MAX
fileName = "start.ax", "obj", "hsptmp", "packfile"
dim fileChk, FILETYPE_MAX
fileChk = 1, 1, 1, 0
sdim targetFolder, 256
Message = "" serchSubFolder = 1 serchHideFiles = 0 targetFolder = dir_mydoc return
*MAKE_SCREEN
screen MAIN_SCREEN, WINX, WINY, 2
syscolor 15 : boxf
title PROGRAM_NAME
return
*SET_OBJECT
sysfont 17 : syscolor 8
dy = 0
objsize BUTTON_X, BUTTON_Y
pos MARGIN_X, MARGIN_Y + dy
mes "対象フォルダ" : dy += ginfo_mesy + LINE_BREAK
pos MARGIN_X + TAB, MARGIN_Y + dy
input targetFolder, WINX - MARGIN_X*2 - BUTTON_X - TAB, BUTTON_Y
id_targetFolder = stat
pos WINX - MARGIN_X - BUTTON_X, MARGIN_Y + dy
button gosub "参照", *SELECT_FOLDER : dy += BUTTON_Y + SEPARATE
tmp = dy
pos MARGIN_X, MARGIN_Y + dy
mes "対象ファイル" : dy += ginfo_mesy + LINE_BREAK
pos MARGIN_X + TAB, MARGIN_Y + dy
objsize FRAME, BUTTON_Y
repeat FILETYPE_MAX
chkbox fileName(cnt), fileChk(cnt)
loop
dy += BUTTON_Y * FILETYPE_MAX + SEPARATE
objsize FRAME - TAB, BUTTON_Y
pos MARGIN_X, MARGIN_Y + dy
mes "設定" : dy += ginfo_mesy + LINE_BREAK
pos MARGIN_X + TAB, MARGIN_Y + dy
chkbox "サブフォルダを検索する", serchSubFolder
dy = tmp
pos MARGIN_X + FRAME, MARGIN_Y + dy
mes "メッセージ" : dy += ginfo_mesy + LINE_BREAK
pos MARGIN_X + FRAME + TAB, MARGIN_Y + dy
mesbox Message, WINX - MARGIN_X*2 - FRAME - TAB, WINY - MARGIN_Y*2 - SEPARATE - BUTTON_Y - dy
iMesbox = stat
dx = BUTTON_X
objsize BUTTON_X, BUTTON_Y
pos WINX - MARGIN_X - dx, WINY-MARGIN_Y - BUTTON_Y
button goto "終了", *END_PROGRAM : dx += BUTTON_X
pos WINX - MARGIN_X - dx, WINY-MARGIN_Y - BUTTON_Y
button gosub "実行", *DELETE_START : dx += BUTTON_X
id_EXE = stat
return
*SELECT_FOLDER
selfolder targetFolder, ""
if stat == 0 {
objprm id_targetFolder, targetFolder
objsel id_EXE
}
return
*DELETE_START
Many = 0 : Message = ""
repeat FILETYPE_MAX
if fileChk(cnt) == 0 : continue
chdir targetFolder
dirlist2h 128
dirlist2 tmp, fileName(cnt), serchSubFolder
Many += stat : i = cnt
sdim DelList, tmp
notesel DelList
dirlist2r DelList
repeat stat
noteget List, cnt
fullPath = List + "\\" + fileName(i)
exist fullPath
if strsize < 0 : continue // 本来は不要・念のため
delete fullPath // ファイルを削除
Message += fullPath + "\n" // メッセージを出す
loop
loop
if Many {
Message += "作業が終了しました。"+str(Many)+"ファイル削除しました。\n"
} else {
Message += "対象ファイルが見つかりません。\n"
}
objprm iMesbox, Message
return
// データの保存
*DATA_SAVE
saveData = ""
notesel saveData
noteadd targetFolder
noteadd str(serchSubFolder)
repeat FILETYPE_MAX
noteadd str(fileChk(cnt))
loop
bsave dir_exe + "\\" + DATAFILE, saveData
return
// データの読み出し
*DATA_LOAD
exist dir_exe + "\\" + DATAFILE
if strsize < 0 : return
notesel saveData : i = 0
bload dir_exe + "\\" + DATAFILE, saveData
noteget targetFolder, i : i++
noteget tmp, i : i++
serchSubFolder = int(tmp)
repeat FILETYPE_MAX
if i >= notemax : break
noteget tmp, i : i++
fileChk(cnt) = int(tmp)
loop
return
// プログラム終了
*END_PROGRAM
gosub *DATA_SAVE
end
|