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