Annotation of OpenXM_contrib2/windows/post-msg-asirgui/asirgui.mac, Revision 1.9
1.9 ! takayama 1: // $OpenXM: OpenXM_contrib2/windows/post-msg-asirgui/asirgui.mac,v 1.8 2013/12/19 04:24:39 takayama Exp $
1.5 takayama 2: // Keep shift-jis code!
1.7 takayama 3: // run "cmd /c "+$asirpath+"cmdasir %f" + " >con"; output debugmsg
1.5 takayama 4: call Main;
5: endmacro;
6: Main:
7: $asirpath=getenv("HOMEPATH")+"\\Desktop\\asir\\bin\\";
8: $asir_rootdir=getenv("ASIR_ROOTDIR");
9: if($asir_rootdir!="" && existfile($asir_rootdir+"\\bin\\asirgui.exe")) {
10: $asirpath=$asir_rootdir+"\\bin\\";
11: }
1.7 takayama 12: menu "asirgui起動","編集中のファイルの実行","選択範囲の実行","行の実行","選択範囲の実行(paste)","行の実行(paste)","計算中断";
1.5 takayama 13: if (result==0) endmacro;
14: else if (result == 1) {
15: run $asirpath+"asirgui";
16: } else if (result == 2) {
1.9 ! takayama 17: save ;
1.7 takayama 18: run "cmd /c \""+$asirpath+"cmdasir\" %f";
1.5 takayama 19: } else if (result == 3) {
20: call ExecuteSelectedArea;
21: } else if (result == 4) {
22: call ExecuteSelectedLine;
23: } else if (result == 5) {
24: call ExecuteSelectedAreaByPaste;
25: } else if (result == 6) {
26: call ExecuteSelectedLineByPaste;
1.7 takayama 27: } else if (result == 7) {
28: call AbortAsir;
1.5 takayama 29: }
30: return true;
31: ExecuteSelectedArea:
32: if(selecting) {
33: $s = gettext(seltopx,seltopy,selendx,selendy);
34: // message "選択範囲は、" + $s + "です. ステルスウインドウに書き出すのはまだ書いてない.";
35: $tmp_fname = getenv("TEMP")+"\\cmdasir-tmp-hidemaru.rr";
36: run "cmd /c del "+$tmp_fname ;
37: call MakeFile $tmp_fname,$s;
1.7 takayama 38: run "cmd /c \""+$asirpath+"cmdasir\" "+$tmp_fname;
1.5 takayama 39: } else {
40: message "範囲選択されていません";
41: }
42: return true;
43: ExecuteSelectedLine:
44: golinetop;
45: beginsel;
46: golineend;
47: // message(str(seltopx) + "," + str(seltopy) + "," + str(selendx) + "," + str(selendy));
48: call ExecuteSelectedArea;
49: return true;
50:
51: // MakeFile in cmd_perl. See
52: // http://d.hatena.ne.jp/ohtorii/
53: // https://github.com/ohtorii
54:
55: MakeFile:
56: $$tmp_filename = $$1;
57: ##old_charset = charset;
58: $$text=$$2;
59: ##prev_hidemaru = hidemaruhandle(0);
60:
61: openfile "/h " + $$tmp_filename;
62: if(! result){
63: message("テンポラリファイルのオープンに失敗。\n" + $$tmp_filename);
64: return false;
65: }
66: ##new_hidemaru = hidemaruhandle(0);
67: setencode ##old_charset,1;
68: insert $$text;
69:
70: save;
71: setactivehidemaru ##prev_hidemaru;
72: closehidemaruforced ##new_hidemaru;
73: return true;
74:
75: ExecuteSelectedAreaByPaste:
76: if(selecting) {
77: $s = gettext(seltopx,seltopy,selendx,selendy);
78: // message "選択範囲は、" + $s + "です. ステルスウインドウに書き出すのはまだ書いてない.";
79: $tmp_fname = getenv("TEMP")+"\\cmdasir-tmp-hidemaru.rr";
80: run "cmd /c del "+$tmp_fname ;
81: call MakeFile $tmp_fname,$s;
1.7 takayama 82: run "cmd /c \""+$asirpath+"cmdasir\" --paste-contents "+$tmp_fname;
1.5 takayama 83: } else {
84: message "範囲選択されていません";
85: }
86: return true;
87: ExecuteSelectedLineByPaste:
88: golinetop;
89: beginsel;
90: golineend;
91: // message(str(seltopx) + "," + str(seltopy) + "," + str(selendx) + "," + str(selendy));
92: call ExecuteSelectedAreaByPaste;
93: return true;
94:
1.7 takayama 95: AbortAsir:
1.8 takayama 96: run "\""+$asirpath+"cmdasir\" --abort"+" >nul";
1.7 takayama 97: return true;
98:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>