📄 auto_do.pas
字号:
unit auto_do;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, RXClock, Menus;
type
Tmain = class(TForm)
Timer1: TTimer;
RxClock1: TRxClock;
MainMenu1: TMainMenu;
N1: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N2: TMenuItem;
procedure Timer1Timer(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
main: Tmain;
flag_stat:integer;
ts:tstrings;
implementation
{$R *.DFM}
procedure Tmain.Timer1Timer(Sender: TObject);
var
len_i,find,len,i,j,k,count,i_s:integer;
do_cmd,str_time,end_time,flag,str_rcd_s:array of string;
cmd_str,str_rcd:string;
count_n:array of integer;
begin
ts.Clear ;
ts.LoadFromFile('cg.ini');
setlength(do_cmd,20);
setlength(str_time,20);
setlength(end_time,20);
setlength(flag,20);
setlength(count_n,20);
setlength(str_rcd_s,20);
count:=ts.Count;
i:=0;
k:=0;
find:=0;
while not (count<=0) do
begin
str_rcd_s[k]:=trim(ts.strings[k]);
str_rcd:=trim(ts.strings[k]);
len:=length(str_rcd);
if not ((copy(str_rcd,1,1)='#') or (len=0)) then
begin
count_n[i]:=k;
flag[i]:=copy(str_rcd,1,1);
str_time[i]:= copy(str_rcd,3,8);
end_time[i]:= copy(str_rcd,12,8);
do_cmd[i]:= copy(str_rcd,21,len-20);
find:=1;
i:=i+1;
end;
k:=k+1;
count:=count-1;
end;
i_s:=i;
for j := 0 to i-1 do
begin
if (time>strtotime(str_time[j])) and (time<strtotime(end_time[j])) and (flag[j]='0') then
begin
cmd_str:=do_cmd[j];
winexec(pchar(cmd_str),sw_show);
len_i:=length(str_rcd_s[count_n[j]])-2;
str_rcd_s[count_n[j]]:='1 '+copy(str_rcd_s[count_n[j]],3,len_i);
end;
end;
i:=i_s;
for j := 0 to i-1 do
begin
if (time<strtotime(str_time[j])) or (time>strtotime(end_time[j])) then
begin
len_i:=length(str_rcd_s[count_n[j]])-2;
str_rcd_s[count_n[j]]:='0 '+copy(str_rcd_s[count_n[j]],3,len_i);
end;
end;
count:=ts.count;
ts.Clear ;
for i:=0 to count-1 do
ts.add(str_rcd_s[i]);
if FileExists('cg.ini') then
DeleteFile('cg.ini');
ts.SaveToFile('cg.ini');
end;
procedure Tmain.N2Click(Sender: TObject);
begin
close;
end;
procedure Tmain.FormCreate(Sender: TObject);
begin
//从cg.ini,取参数配置
ts:=tstringlist.create;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -