秀丸マクロとバッチ

秀丸コマンドプロンプトで扱うバッチファイル

hidemaru.bat

"C:\Program Files\Hidemaru\Hidemaru.exe" %1

これをC:\WINDOWSに設置すると、コマンドプロンプト
hidemaru a.php
でa.php秀丸で開ける。

秀丸で開いているphpファイルをシンタックスチェックする秀丸マクロ

phpcheck.mac

$t = getenv("TEMP") + "\\tmp.txt";
run "php -l \"" + filename + "\" > " + $t;
openfile "/h " + $t;
$text = gettext(0,0,8192,linecount2);
message $text;
quit;

秀丸で開いているphpファイルを実行する秀丸マクロ

phpexec.mac

$file = filename;
run "php \"" + $file + "\" > con";
endmacro;

最後に保存したものを実行します。編集中のものを実行する方法知ってる人いませんか?
saveas getenv("TEMP") + "\\tmp.txt";
のようにしてから実行すると、編集中のファイルがtmp.txtに移ってしまうのでよくありません。
はじめにfilenameを変数に格納して、saveasしてphp実行した後、filenameを開けばいけるかな?

追記:保存しなくても編集中のものをPHP実行するバージョンを作成しました。

$file = filename;
selectall;
copy;
$t = getenv("TEMP") + "\\tmp.txt";
saveas  $t;
loadfile $file;
selectall;
paste;
run "php \"" + $t + "\" > con";
endmacro;