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