[BACK]Return to asirgui.mac CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / post-msg-asirgui

File: [local] / OpenXM_contrib2 / windows / post-msg-asirgui / asirgui.mac (download)

Revision 1.11, Sun Mar 30 10:30:05 2014 UTC (10 years, 1 month ago) by takayama
Branch: MAIN
CVS Tags: RELEASE_1_3_1_13b, HEAD
Changes since 1.10: +3 -3 lines

Deleted cmd /c

// $OpenXM: OpenXM_contrib2/windows/post-msg-asirgui/asirgui.mac,v 1.11 2014/03/30 10:30:05 takayama Exp $
// Keep shift-jis code! 
//   run "cmd /c "+$asirpath+"cmdasir %f" + " >con"; output debugmsg
call Main;
endmacro;
Main:
$asirpath=getenv("HOMEPATH")+"\\Desktop\\asir\\bin\\";
$asir_rootdir=getenv("ASIR_ROOTDIR");
if($asir_rootdir!="" && existfile($asir_rootdir+"\\bin\\asirgui.exe")) {
    $asirpath=$asir_rootdir+"\\bin\\";
}
menu "asirgui起動","編集中のファイルの実行","選択範囲の実行","行の実行","選択範囲の実行(paste)","行の実行(paste)","計算中断";
if (result==0) endmacro;
else if (result == 1) {
  run $asirpath+"asirgui";
} else if (result == 2) {
  save ; 
  run "\""+$asirpath+"cmdasir\" \"%f\""+" >nul " ;
} else if (result == 3) {
  call ExecuteSelectedArea;
} else if (result == 4) {
  call ExecuteSelectedLine;
} else if (result == 5) {
  call ExecuteSelectedAreaByPaste;
} else if (result == 6) {
  call ExecuteSelectedLineByPaste;
} else if (result == 7) {
  call AbortAsir;
}
return true;
ExecuteSelectedArea:
  if(selecting) { 
  $s = gettext(seltopx,seltopy,selendx,selendy); 
//  message "選択範囲は、" + $s + "です. ステルスウインドウに書き出すのはまだ書いてない.";
    $tmp_fname = getenv("TEMP")+"\\cmdasir-tmp-hidemaru.rr";
    run "cmd /c del "+$tmp_fname ;
    call MakeFile $tmp_fname,$s;
    run "\""+$asirpath+"cmdasir\" "+$tmp_fname+" >nul";
  } else { 
  message "範囲選択されていません";
  }
  return true; 
ExecuteSelectedLine:
  golinetop;
  beginsel;
  golineend;
//  message(str(seltopx) + "," + str(seltopy) + "," + str(selendx) + "," + str(selendy));
  call ExecuteSelectedArea;
  return true;

// MakeFile in cmd_perl. See 
//	http://d.hatena.ne.jp/ohtorii/
//	https://github.com/ohtorii

MakeFile:
	$$tmp_filename	= $$1;
	##old_charset	= charset;
	$$text=$$2;
	##prev_hidemaru = hidemaruhandle(0);

	openfile "/h " + $$tmp_filename;
	if(! result){
		message("テンポラリファイルのオープンに失敗。\n" + $$tmp_filename);
		return false;
	}
	##new_hidemaru = hidemaruhandle(0);
	setencode ##old_charset,1;
	insert $$text;

	save;
	setactivehidemaru	##prev_hidemaru;
	closehidemaruforced ##new_hidemaru;
	return true;

ExecuteSelectedAreaByPaste:
  if(selecting) { 
  $s = gettext(seltopx,seltopy,selendx,selendy); 
//  message "選択範囲は、" + $s + "です. ステルスウインドウに書き出すのはまだ書いてない.";
    $tmp_fname = getenv("TEMP")+"\\cmdasir-tmp-hidemaru.rr";
    run "cmd /c del "+$tmp_fname ;
    call MakeFile $tmp_fname,$s;
    run "cmd /c \""+$asirpath+"cmdasir\" --paste-contents "+$tmp_fname + " ";
  } else { 
  message "範囲選択されていません";
  }
  return true; 
ExecuteSelectedLineByPaste:
  golinetop;
  beginsel;
  golineend;
//  message(str(seltopx) + "," + str(seltopy) + "," + str(selendx) + "," + str(selendy));
  call ExecuteSelectedAreaByPaste;
  return true;

AbortAsir:
  run "\""+$asirpath+"cmdasir\" --abort"+" >nul";
  return true;