Home > プログラム関連
// ------------------------------------------------------------
// 連番挿入マクロ
// ------------------------------------------------------------
// メイン
$a[0] = "&1:コメント操作";
$a[1] = "&2:連番";
if ( selecting ){
#top_x = seltopx;
#top_y = seltopy;
#end_x = selendx;
#end_y = selendy;
} else {
endmacro;
}
menuarray $a,7;
if( result == 0 ){
endmacro;
} else if( result == 1 ) {
call comment;
} else if( result == 2 ) {
call renban;
}
endmacro;
// コメント操作
comment:
$deli[0] = "/* */";
$deli[1] = "";
$deli[2] = "--";
$deli[3] = "'";
$deli[4] = "//";
$$a[0] = "&1:コメント";
$$a[1] = "&2:コメント解除";
menuarray $$a,5;
if( result == 0 ){
endmacro;
} else if( result == 1 ) {
menuarray $deli,5;
if( result == 0 ){
endmacro;
}
#soeji = result - 1;
#num = strstr($deli[#soeji]," ");
//message str(#num);
escape;
if(#num == -1){
moveto #top_x,#top_y;
while(y != #end_y + 1){
insert $deli[#soeji];
golineend2;
#tmp_x = x;
right;
if (#tmp_x == x) endmacro;
}
}else{
$$str1 = leftstr($deli[#soeji],#num);
$$str2 = rightstr($deli[#soeji],strlen($deli[#soeji]) - #num - 1);
moveto #top_x,#top_y;
insert $$str1;
moveto #end_x,#end_y;
insert $$str2;
}
} else if( result == 2 ) {
menuarray $deli,5;
if( result == 0 ){
endmacro;
}
#soeji = result - 1;
#num = strstr($deli[#soeji]," ");
if(#num == -1){
replaceall $deli[#soeji],"",regular,inselect;
}else{
$$str1 = leftstr($deli[#soeji],#num);
$$str2 = rightstr($deli[#soeji],strlen($deli[#soeji]) - #num - 1);
replaceall "(" + $$str1 + "|" + $$str2 + ")","",regular,inselect;
}
}
endmacro;
// 連番
renban:
escape;
moveto #top_x,#top_y;
$fmt = "000000";
#n = 1;
$input = input("[連番名]001");
while( y != #end_y + 1){
$str = $input + rightstr($fmt + str(#n),3);
insert $str;
left strlen($str);
#n = #n + 1;
golineend2;
#tmp_x = x;
right;
if (#tmp_x == x) endmacro;
}
endmacro;
// ------------------------------------------------------------
// CSS整形
// ------------------------------------------------------------
begingroupundo;
replaceall "$", ";",regular;
replaceall ";;", ";",regular;
replaceall "^", "{",regular;
replaceall "$", "}",regular;
moveto 0,0;
$fmt = "000000";
#n = 1;
$input = input("??連番名を入力してください");
while( y != linecount2-1){
$str = "." + $input + rightstr($fmt + str(#n),3);
insert $str;
left strlen($str);
#n = #n + 1;
golineend2;
right;
}
replaceall "(;|{)", "\\0\\n",regular;
replaceall "^[^.}]+", "\\t\\0",regular;
endgroupundo;
endmacro;