/* * .hmbook をファイルマネージャ枠で開く秀丸マクロ * * Ver.2.1 (2014-01-22) * * 拡張子が .hmbook のファイルを秀丸エディタで開いた状態で * このマクロを実行すると、それをファイルマネージャ枠で開きます。 * * Windows のレジストリの設定により、.hmbook ファイルが開かれる時に * 秀丸エディタの起動オプション /x により実行されることを想定しています。 * その時同時に、起動オプション /a により、.hmbook ファイルのパスを * マクロに引数として渡す必要があります。 * * Yasunori Miyamoto * http://tipszone.jp/20121003_hidemaru-config/#hmbook * mailto: nori@tipszone.jp */ $hmbook = getarg(0); if (hidemarucount == 1) showwindow 1; else call CLOSE_CURRENT_TAB; if (rightstr($hmbook, 7) != ".hmbook") endmacro; call GET_HMBOOK_TYPE, $hmbook; $$hmbook_type = $$return; loaddll "HmExplorerPane.dll"; if ($$hmbook_type == "bookmark") { loadbookmark $hmbook; ##_ = dllfunc("SetMode", hidemaruhandle(0), 4); } else if ($$hmbook_type == "project") { ##_ = dllfunc("LoadProject", hidemaruhandle(0), $hmbook); ##_ = dllfunc("SetMode", hidemaruhandle(0), 5); } freedll; endmacro; // hmbookファイルの1行目に記述されているtype属性の値を取得する。 // Param: string hmbookファイルのフルパス // Return: string 引数で指定されたhmbookファイルのtype属性の値 // 普通は "project" または "bookmark" GET_HMBOOK_TYPE: openfile "/h " + $$1; moveto2 0, 1; $$first_line = gettext2(0, 1, linelen2, 1); call CLOSE_CURRENT_TAB; ##i = strrstr($$first_line, "type="); if (##i == -1) return ""; return rightstr($$first_line, strlen($$first_line) - ##i - 5); // 現在のタブを閉じる。 // ※最後のタブを閉じるとマクロは終了する。 CLOSE_CURRENT_TAB: if (hidemarucount == 1) exit; setactivehidemaru 1; closehidemaruforced 1; return;