[Ttssh2-commit] [7700] exec マクロコマンドの実行結果を result システム変数に代入するようにした

scmno****@osdn***** scmno****@osdn*****
2019年 5月 21日 (火) 23:26:57 JST


Revision: 7700
          https://osdn.net/projects/ttssh2/scm/svn/commits/7700
Author:   zmatsuo
Date:     2019-05-21 23:26:57 +0900 (Tue, 21 May 2019)
Log Message:
-----------
exec マクロコマンドの実行結果を result システム変数に代入するようにした

- 従来は実行結果を取得することができない場合があった

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/macro/command/exec.html
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/macro/command/exec.html
    trunk/teraterm/ttpmacro/ttl.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-05-20 15:39:41 UTC (rev 7699)
+++ trunk/doc/en/html/about/history.html	2019-05-21 14:26:57 UTC (rev 7700)
@@ -44,8 +44,8 @@
     <ul>
       <li>Display position of IME's conversion candidate window can not follow cursor position. This bug was introduced in 4.102.</li>
       <li>Can't display character such as U+2014 EM DASH, U+2212 MINUS SIGN, U+301C WAVE DASH etc. This bug was introduced in 4.102.</li>
-      <li>MACRO: Stop macro when <a href="../macro/command/exec.html">exec</a> command can not execute applicaton.</li>
       <li>MACRO: Fix handle leak when <a href="../macro/command/exec.html">exec</a> command is executed.</li>
+      <li>MACRO: Store <a href="../macro/command/exec.html">exec</a> command result to result variable.</li>
     </ul>
   </li>
 

Modified: trunk/doc/en/html/macro/command/exec.html
===================================================================
--- trunk/doc/en/html/macro/command/exec.html	2019-05-20 15:39:41 UTC (rev 7699)
+++ trunk/doc/en/html/macro/command/exec.html	2019-05-21 14:26:57 UTC (rev 7700)
@@ -28,6 +28,15 @@
 Runs an application specified by <command line>.
 </p>
 
+`result' system variable returns following values.
+<dl>
+  <dt>0</dt>
+  <dd>success to execute an application, when <wait> is 0 or is not specified.</dd>
+  <dt>-1</dt>
+  <dd>fail to execute an application</dd>
+  <dt>exit code of the application</dt>
+  <dd>success to execute an application, when <wait> is 1</dd>
+</dl>
 
 <h2>Parameters</h2>
 <dl>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-05-20 15:39:41 UTC (rev 7699)
+++ trunk/doc/ja/html/about/history.html	2019-05-21 14:26:57 UTC (rev 7700)
@@ -44,8 +44,8 @@
     <ul>
       <li>IME\x82̕ϊ\xB7\x8C\xF3\x95\xE2\x83E\x83B\x83\x93\x83h\x83E\x82̕\\x8E\xA6\x88ʒu\x82\xAA\x83J\x81[\x83\\x83\x8B\x88ʒu\x82ɒǏ]\x82\xB5\x82Ȃ\xA2\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B4.102\x82ł̃G\x83\x93\x83o\x83O\x81B</li>
       <li>U+2014 EM DASH, U+2212 MINUS SIGN, U+301C WAVE DASH \x93\x99\x82̕\xB6\x8E\x9A\x82\xAA\x95\\x8E\xA6\x82ł\xAB\x82Ȃ\xA2\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B4.102\x82ł̃G\x83\x93\x83o\x83O\x81B</li>
-      <li>MACRO: <a href="../macro/command/exec.html">exec</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82ŃA\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82̎\xC0\x8Ds\x82Ɏ\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x81A\x83G\x83\x89\x81[\x82\xAA\x8Fo\x82ă}\x83N\x83\x8D\x82\xAA\x92\xE2\x8E~\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
       <li>MACRO: <a href="../macro/command/exec.html">exec</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82\xF0\x8E\xC0\x8Ds\x82\xB7\x82\xE9\x82ƃn\x83\x93\x83h\x83\x8B\x83\x8A\x81[\x83N\x82\xAA\x94\xAD\x90\xB6\x82\xB7\x82\xE9\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
+      <li>MACRO: <a href="../macro/command/exec.html">exec</a> \x83}\x83N\x83\x8D\x83R\x83}\x83\x93\x83h\x82̎\xC0\x8Ds\x8C\x8B\x89ʂ\xF0 result \x83V\x83X\x83e\x83\x80\x95ϐ\x94\x82ɑ\xE3\x93\xFC\x82\xB7\x82\xE9\x82悤\x82ɂ\xB5\x82\xBD\x81B</li>
     </ul>
   </li>
 

Modified: trunk/doc/ja/html/macro/command/exec.html
===================================================================
--- trunk/doc/ja/html/macro/command/exec.html	2019-05-20 15:39:41 UTC (rev 7699)
+++ trunk/doc/ja/html/macro/command/exec.html	2019-05-21 14:26:57 UTC (rev 7700)
@@ -28,6 +28,15 @@
 \x83R\x83}\x83\x93\x83h\x83\x89\x83C\x83\x93\x95\xB6\x8E\x9A\x97\xF1 <command line> \x82ɏ]\x82\xA2\x81A\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82\xF0\x8BN\x93\xAE\x82\xB7\x82\xE9\x81B
 </p>
 
+result \x83V\x83X\x83e\x83\x80\x95ϐ\x94\x82͎\x9F\x82̒l\x82\xF0\x8E\xE6\x82\xE9\x81B
+<dl>
+  <dt>0</dt>
+  <dd>\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82̎\xC0\x8Ds\x82ɐ\xAC\x8C\xF7\x81A<wait> \x83p\x83\x89\x83\x81\x81[\x83^\x82\xAA 0 \x96\x94\x82́A\x8Ew\x92肳\x82\xEA\x82Ă\xA2\x82Ȃ\xA2</dd>
+  <dt>-1</dt>
+  <dd>\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82̎\xC0\x8Ds\x82Ɏ\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ</dd>
+  <dt>\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82̏I\x97\xB9\x83R\x81[\x83h</dt>
+  <dd>\x83A\x83v\x83\x8A\x83P\x81[\x83V\x83\x87\x83\x93\x82̎\xC0\x8Ds\x82ɐ\xAC\x8C\xF7\x81A<wait> \x83p\x83\x89\x83\x81\x81[\x83^\x82\xAA 1 \x82Ɏw\x92肳\x82\xEA\x82Ă\xA2\x82Ȃ\xA2</dd>
+</dl>
 
 <h2>\x83p\x83\x89\x83\x81\x81[\x83^</h2>
 <dl>

Modified: trunk/teraterm/ttpmacro/ttl.c
===================================================================
--- trunk/teraterm/ttpmacro/ttl.c	2019-05-20 15:39:41 UTC (rev 7699)
+++ trunk/teraterm/ttpmacro/ttl.c	2019-05-21 14:26:57 UTC (rev 7700)
@@ -1240,12 +1240,20 @@
 	else
 		bRet = CreateProcess(NULL, Str, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, CurDir, &sui, &pi);
 	if (bRet == FALSE) {
+		// \x8E\xC0\x8Ds\x82ł\xAB\x82Ȃ\xA9\x82\xC1\x82\xBD\x8Fꍇ\x81Aresult\x82\xC9-1\x82\xF0\x95Ԃ\xB7
+		SetResult(-1);
+#if 0
+		// \x83G\x83\x89\x81[\x82ɂȂ\xE9
 		Err = ErrCantExec;
+#endif
 	} else {
 		if (wait) {
+			// \x8E\xC0\x8Ds & wait\x8Ew\x92\xE8
 			WaitForSingleObject(pi.hProcess, INFINITE);
 			GetExitCodeProcess(pi.hProcess, &ret);
 			SetResult(ret);
+		} else {
+			SetResult(0);
 		}
 		CloseHandle(pi.hThread);
 		CloseHandle(pi.hProcess);


Ttssh2-commit メーリングリストの案内