// // ソーシャルゲーム用の各種データを編集する 秀丸マクロ // // 2015/04/05 Tsukasa // // つかさの天クリページ http://fs.ameba.jp/profile?userId=2422 // #org_lineno = lineno; #org_column = column + 1; START: movetolineno #org_column, #org_lineno; title "ソーシャルゲーム用の各種データを編集するマクロ"; #i = 0; $cmd[#i] = "" ; $menu[#i] = "≪キャンセル≫"; #i = #i + 1; $cmd[#i] = "fs_swap" ; $menu[#i] = "天クリ:カードスキルTXT:PWの行と攻防値の行の順序を統一する"; #i = #i + 1; $cmd[#i] = "fs_claen" ; $menu[#i] = "天クリ:カードスキルTXT:不要文字列を削除"; #i = #i + 1; $cmd[#i] = "fs_format1" ; $menu[#i] = "天クリ:カードスキルTXT:整形第1段階:1行に整形"; #i = #i + 1; $cmd[#i] = "fs_format2" ; $menu[#i] = "天クリ:カードスキルTXT:整形第2段階:カード名部分をwiki用のリンクタグへ変換"; #i = #i + 1; $cmd[#i] = "fs_convcsv" ; $menu[#i] = "天クリ:カードスキルCSV:コピペした文字列を1行のCSV形式へ変換"; #i = #i + 1; mousemenuarray $menu, #i; if( result <= 1 ) endmacro; #menunum = result -1; title $menu[#menunum]; if ( $cmd[#menunum] == "fs_swap" ) { // 天クリ:カードスキルTXT:PWの行と攻防値の行の順序を統一する $sStr = "^.*攻[^0-9A-Za-z]*[0-9A-Za-z]+.*防[^0-9A-Za-z]*[0-9A-Za-z]+.*\\n\\f.*PW[^0-9]*[0-9]+.*\\n"; $rStr = "\\1\\0"; call execReplacedown $sStr, $rStr; goto START; } if ( $cmd[#menunum] == "fs_claen" ) { // 天クリ:カードスキルTXT:不要文字列を削除 $sStr = "^( +|効果[ ::]+)|\\n?\\n(イベント有利.*)|.*(成長型.*|スキル[ ::]+.*|有利カード.*|効果[ ::]+)\\n"; $rStr = ""; call execReplacedown $sStr, $rStr; goto START; } if ( $cmd[#menunum] == "fs_format1" ) { // 天クリ:カードスキルTXT:整形第1段階:1行に整形 $sStr = "^[^,\\n\\((]+\\f[\\((]\\f[光森水][\\t・][^\\))]+\\f[\\))].*\\n.*PW[^0-9]*\\f[0-9]+\\f.*\\n.*攻[^0-9A-Za-z]*\\f[0-9A-Za-z]+\\f.*防[^0-9A-Za-z]*\\f[0-9A-Za-z]+\\f.*\\n"; $rStr = "\\0\\t\\2\\t\\4\\t\\6\\t\\8\\t"; call execReplacedown $sStr, $rStr; goto START; } if ( $cmd[#menunum] == "fs_format2" ) { // 天クリ:カードスキルTXT:整形第2段階:カード名部分をwiki用のリンクタグへ変換 $sStr = "^\\n?\\f[^,\\n\\t]+\\f\\t\\f[光森水]\\f[\\t・]\\f[^\\t]+\\t[0-9]+\\t[0-9A-Za-z]+\\t[0-9A-Za-z]+\\t"; $rStr = ",[[\\1>カード/\\3/\\1]]\\t\\3\\t\\5"; call execReplacedown $sStr, $rStr; goto START; } if ( $cmd[#menunum] == "fs_convcsv" ) { // 天クリ:カードスキルCSV:コピペした文字列を1行のCSV形式へ変換 $sStr = "^[^\\n0-9]*\\n?\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f\\n?[^0-9]*\\n\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f"; $rStr = "\\1,\\3,\\5,\\7,\\9"; call execReplacedown $sStr, $rStr; goto START; } if ( $cmd[#menunum] == "convertBackslashForSearch" ) { $sStr = "^[^\\n0-9]*\\n?\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f\\n?[^0-9]*\\n\\f[0-9]+\\f\\n[^0-9]*\\n\\f[0-9]+\\f"; call convertBackslashForSearch $sStr; title $$return; call playSound; goto START; } endmacro; // // サブルーチン // // // // 置換実行 // execReplacedown: $$s =searchbuffer; ##f =searchoption; replacedown $$1, $$2, ask, regular; ##r = ##result; call playSound; setsearch $$s,##f; return ##r; // // サウンド再生 // playSound: $$t = "C:\\WINDOWS\\Media\\notify.wav"; if ( existfile($$t) ) $$soundFile = $$t; $$t = "C:\\WINNT\\Media\\notify.wav"; if ( existfile($$t) ) $$soundFile = $$t; $$t = "E:\\WINNT\\Media\\notify.wav"; if ( existfile($$t) ) $$soundFile = $$t; $$t = "E:\\WINNT\\Media\\Windows XP Pop-up Blocked.wav"; if ( existfile($$t) ) $$soundFile = $$t; playsync $$soundFile; return ##result; // // 【ダメ:文字列の時点で\nは改行コードになっているから。】 // 検索文字列用に¥を¥¥へ変換 // convertBackslashForSearch: ##result = 0; $$s = $$1; ##i = 0; while ( ##i < strlen($$s) ) { ##c = ascii(midstr($$s,##i,1)); if ( (##c >= 0x81 && ##c <= 0x9F) || (##c >= 0xE0 && ##c <= 0xFC) ) { // Shift_JISの第1バイト ##i = ##i + 1; } else if (##c == 0x5c) { $$s = leftstr($$s, ##i) + char(0x5C) + rightstr($$s, strlen($$s) - ##i); ##i = ##i + 1; } ##i = ##i + 1; } return $$s;