English help on website



プログラム実行の詳細(Ver9.34対応版)
目次コマンドそのほかのコマンドプログラム実行の詳細− ファイルのエンコードのまま入出力するマクロ

「perl -w <con >con」を例にした、ファイルのエンコードのまま入出力するマクロの例です。

この方法は比較的古い方法です。
runexや、hidemaru.runProcessで細かい動作でやりとりが可能です。(詳細はマクロヘルプ参照)

$cmdline = "perl -w";

disablehistory 0xff;
disabledraw;

#encode=encode;
selectall;
copy;
openfile "/n";	//newfile;
paste;
call GetTempFile "tempinput";
$tempinput = $$return;
if($tempinput=="")endmacro;
setencode #encode,1;
saveas $tempinput;

call GetTempFile "tempoutput";
$tempoutput = $$return;
if($tempoutput=="")endmacro;
run $cmdline + " <\"" + $tempinput + "\" >\"" + $tempoutput + "\"";

#h=hidemaruhandle(0);
openfile "/n /f" + str(#encode) + " \"" + $tempoutput + "\"";
closehidemaru #h;
changename "";
clearupdated;

if($tempinput!=""){
    deletefile $tempinput;
}
if($tempoutput!=""){
    deletefile $tempoutput;
}
endmacro;

//テンポラリファイル作成サブルーチン
GetTempFile:
#n=0;
while(#n<1000){
    if( !existfile( $$1+str(#n) ) ) return $$1+str(#n);
    #n = #n + 1;
}
return "";