Code: Select all
Macro
Area="Shell"
Key="AltShiftF6"
Description="# Change file name"
{{
$If (APanel.Plugin) $AKey $Exit $End
%F=APanel.Current;
$If (substr(%F,-1)=="]" || substr(%F,-1)==")" || substr(%F,-1)=="}") %N=%F; %X=""; $Else %N=fsplit(%F,4); %X=fsplit(%F,8); $End
%S=prompt("|"+%N+"|"+%X,"Изменить имя на:",0x30, %N, "HistoryChangeFileName");
$If (%S) ShiftF6 print(%S+%X); Enter $End
}}
Code: Select all
{{
$If (APanel.Plugin) $AKey $Exit $End
%F=APanel.Current;
$If (substr(%F,-1)=="]" || substr(%F,-1)==")" || substr(%F,-1)=="}") %N=%F; %X=""; $Else %N=fsplit(%F,4); %X=fsplit(%F,8); $End
;;Find remark(s)
%RIS=rindex(%N,"{");
%RIE=rindex(%N,"}");
$If (%RIS!=-1 && %RIE!=-1)
%R=trim(substr(%N,%RIS+1,%RIE-%RIS-1));
%N=trim(substr(%N,0,%RIS))+" "+trim(substr(%N,%RIE+1));
$Else
%R="";
$End
;;Find author(s)
%AIS=index(%N,"[");
%AIE=index(%N,"]");
$If (%AIS!=-1 && %AIE!=-1)
%T=trim(substr(%N,0,%AIS));
%A=trim(substr(%N,%AIS+1,%AIE-%AIS-1));
%N=trim(substr(%N,%AIE+1));
$Else
%A="";
%T="";
$End
;;Find year / edition
%EIS=rindex(%N,"(");
%EIE=rindex(%N,")");
$If (%EIS!=-1 && %EIE!=-1)
;;Find edition
%E=trim(substr(%N,%EIS+1,%EIE-%EIS-1));
$If (fmatch(%E,"/.*\\D$/")==1)
%N=trim(substr(%N,0,%EIS))+" "+trim(substr(%N,%EIE+1));
%YIS=rindex(%N,"(");
%YIE=rindex(%N,")");
$Else
%E="";
%YIS=%EIS;
%YIE=%EIE;
$End
;;Find year
%Y=trim(substr(%N,%YIS+1,%YIE-%YIS-1));
%YL=len(%Y);
$If ((%YL<=4 && fmatch(%Y,"/\\d+/")==1) || (%YL>=7 && %YL<=10 && fmatch(%Y,"/\\d{3,4}.\\d{1,2}.\\d{1,2}/")==1))
%N=trim(substr(%N,0,%YIS))+" "+trim(substr(%N,%YIE+1));
$Else
%Y="";
$End
$Else
%Y="";
%E="";
$End
;;Find title
%T=trim(%T+" "+trim(%N));
;;Edit book name
$While(1)
;;Edit selected (space to delete field)
%Idx=Menu.Show("\1&Название\n&1. "+%T+"\n\1&Автор\n&2. "+%A+"\n\1&Год\n&3. "+%Y+"\n\1&Издание\n&4. "+%E+"\n\1&Примечания\n&5. "+%R+"\n","Добавить или изменить",0x8);
%Changed=0;
$If (%Idx==2)
%S=prompt("|"+%T+"|","Название:",0x30, %T);
$If (%S) %T=trim(%S); $End
$Else
$If (%Idx==4)
%S=prompt("|"+%A+"|","Автор:",0x30, %A);
$If (%S) %A=trim(%S); $End
$Else
$If (%Idx==6)
%S=prompt("|"+%Y+"|","Год:",0x30, %Y);
$If (%S) %Y=trim(%S); $End
$Else
$If (%Idx==8)
%S=prompt("|"+%E+"|","Издание:",0x30, %E);
$If (%S) %E=trim(%S); $End
$Else
$If (%Idx==10)
%S=prompt("|"+%R+"|","Примечания:",0x30, %R);
$If (%S) %R=trim(%S); $End
$Else
$Break
$End
$End
$End
$End
$End
;;
%F=%T;
$If (%A!="") %F=%F+" ["+%A+"]"; $End
$If (%Y!="") %F=%F+" ("+%Y+")"; $End
$If (%E!="") %F=%F+" ("+%E+")"; $End
$If (%R!="") %F=%F+" {"+%R+"}"; $End
%F=%F+%X;
$If (%F!=APanel.Current) ShiftF6 print(%F); Enter $End
$End
}}
"Основы криптологии [Х.Тилборг] (2006) {Src}.zip"
"Язык программирования C++ [Б.Страуструп] (2011) (Специальное издание).djvu"
"Язык программирования C++ [Б.Страуструп] (2011) (Специальное издание).djvu"