//再执行大小写转换
case combobox1.ItemIndex of
0: rnlist1.Cols[1]:=tmplist;
1: for nn:=1 to rnlist1.RowCount-1 do //首字母大写,其他小写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=uppercase(tmplist.Strings[nn][1])+lowercase(copy(tmplist.Strings[nn],2,length(tmplist.Strings[nn])-1));
2: for nn:=1 to rnlist1.RowCount-1 do //全部大写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=uppercase(tmplist.Strings[nn]);
3: for nn:=1 to rnlist1.RowCount-1 do //全部小写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=lowercase(tmplist.Strings[nn]);
4: for nn:=1 to rnlist1.RowCount-1 do //文件名大写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=uppercase(getffname(tmplist.Strings[nn]))+extractfileext(tmplist.Strings[nn]);
5: for nn:=1 to rnlist1.RowCount-1 do //文件名小写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=lowercase(getffname(tmplist.Strings[nn]))+extractfileext(tmplist.Strings[nn]);
6: for nn:=1 to rnlist1.RowCount-1 do //扩展名大写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=getffname(tmplist.Strings[nn])+uppercase(extractfileext(tmplist.Strings[nn]));
7: for nn:=1 to rnlist1.RowCount-1 do //扩展名小写
if rnlist1.Cells[0,nn]<>'' then
rnlist1.Cells[1,nn]:=getffname(tmplist.Strings[nn])+lowercase(extractfileext(tmplist.Strings[nn]));
end;
rnlist1.Cells[1,0]:='新文件名';
end;
procedure TBM_CHANGEFILEF.SpeedButton4Click(Sender: TObject);
var nn:integer;
begin
SpeedButton3click(self);//先执行预览,然后根据预览结果改名
for nn:=1 to rnlist1.RowCount-1 do
if rnlist1.Cells[0,nn]<>'' then
RenameFile(rnlist1.Cells[2,nn]+rnlist1.Cells[0,nn],rnlist1.Cells[2,nn]+rnlist1.Cells[1,nn]);
rnlist1.Cols[0]:= rnlist1.Cols[1];
rnlist1.Cells[0,0]:='原文件名';
showmessage('文件改名完毕!');
end;
procedure TBM_CHANGEFILEF.CheckBox1Click(Sender: TObject);
begin
radiob1.Enabled := checkbox1.Checked;
radiob2.Enabled := checkbox1.Checked;
ledit1.Enabled := checkbox1.Checked;
updown1.Enabled := checkbox1.Checked;
label3.Enabled := checkbox1.Checked;
label4.Enabled := checkbox1.Checked;
combobox2.Enabled := checkbox1.Checked;
checkbox2.Enabled := checkbox1.Checked;
end;
procedure TBM_CHANGEFILEF.RadioB1Click(Sender: TObject);
begin
if radiob1.Checked then
ledit1.Text :='0';
updown1.Position :=0;
end;
procedure TBM_CHANGEFILEF.RadioB2Click(Sender: TObject);
begin
if radiob2.Checked then
ledit1.Text :='A';
updown1.Position :=0;
end;
procedure TBM_CHANGEFILEF.UpDown1ChangingEx(Sender: TObject;
var AllowChange: Boolean; NewValue: Smallint;
Direction: TUpDownDirection);
begin
if radiob1.Checked then
if direction=updup then
ledit1.Text :=inttostr(strtoint(ledit1.Text)+1)
else
begin if strtoint(ledit1.Text)>0 then
ledit1.Text :=inttostr(strtoint(ledit1.Text)-1);
end
else if direction=updUp then ledit1.Text :=getletter(ledit1.Text,true,1)
else ledit1.Text :=getletter(ledit1.Text,false,1);
end;
procedure TBM_CHANGEFILEF.CheckBox2Click(Sender: TObject);
begin
combobox3.Enabled:= checkbox2.Checked;
end;
procedure TBM_CHANGEFILEF.FormCreate(Sender: TObject);
begin
rnlist1.Cells[0,0]:='原文件名';
rnlist1.Cells[1,0]:='新文件名';
rnlist1.Cells[2,0]:='文件路径';
totanum:=1;
label4.Caption :='模板说明:'+#13
+'用*符号 代表原文件名(或扩展名);'+#13
+'用<X>符号 代表原文件名(或扩展名)中第'+#13
+' X个字母,X为数字;'+#13
+'用?符号 替换原文件名(或扩展名)中对应'+#13
+' 位置的字母为数字或字母;' ;
end;
procedure TBM_CHANGEFILEF.SearchFile(path: string);
var
sr: TSearchRec;
begin
{
if FindFirst(path,faanyfile, sr) = 0 then
repeat
if (sr.name<>'.') and (sr.name<>'..') then
if (sr.Attr and fadirectory) = fadirectory then
SearchFile(path+'\'+sr.name)
else
<< 上一页 [21] [22] [23] [24] [25] [26] 下一页