svnno****@sourc*****
svnno****@sourc*****
2009年 5月 19日 (火) 22:28:06 JST
Revision: 3413 http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3413 Author: maya Date: 2009-05-19 22:28:06 +0900 (Tue, 19 May 2009) Log Message: ----------- ãã¯ãã³ãã³ã exec ã«ã第3å¼æ°(ãªãã·ã§ã³)ã追å ã CreateProcess ã§èµ·åãã¦çµäºãå¾ ã¡ãè¿ãå¤ã 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 2009-05-19 11:26:12 UTC (rev 3412) +++ trunk/doc/en/html/about/history.html 2009-05-19 13:28:06 UTC (rev 3413) @@ -74,6 +74,7 @@ </ul></li--> <li>added the `|' character into the clickable URL as a part of composition characters.</li> <!--li>R}hCIvVÅA <a href="../commandline/teraterm.html#f">/F</a> IvVͼÌIvVæèæÉ·é(㫳êé)æ¤ÉÏXµ½B</li--> + <!--li>}NR}h "<a href="../macro/command/exec.html">exec</a>" ÉAN®µ½AvP[VÌI¹R[hð result Éi[·é½ßÌIvVðÇÁµ½B</li--> </ul></li> <li>Bug fixes Modified: trunk/doc/en/html/macro/command/exec.html =================================================================== --- trunk/doc/en/html/macro/command/exec.html 2009-05-19 11:26:12 UTC (rev 3412) +++ trunk/doc/en/html/macro/command/exec.html 2009-05-19 13:28:06 UTC (rev 3413) @@ -18,7 +18,7 @@ </p> <pre class="macro-syntax"> -exec <command line> [<show>] +exec <command line> [<show> [<wait>]] </pre> <h2>Remarks</h2> @@ -35,6 +35,8 @@ show ;default parameters when no show command specified. </pre> +<!--<wait> p[^É 1 ðwè·éÆAN®µ½AvP[VªI¹·éÜÅÒÂBAvP[VÌI¹R[hª result VXeÏÉi[³êéB<em>(version 4.63 or later)</em>--> + <h2>Example</h2> <pre class="macro-example"> Modified: trunk/doc/ja/html/about/history.html =================================================================== --- trunk/doc/ja/html/about/history.html 2009-05-19 11:26:12 UTC (rev 3412) +++ trunk/doc/ja/html/about/history.html 2009-05-19 13:28:06 UTC (rev 3413) @@ -74,6 +74,7 @@ </ul></li> <li>NbJuURLɨ¢ÄAo[eBJo[(|)ðURL\¬¶ÆµÄ¯Ê·éæ¤Éµ½B</li> <li>R}hCIvVÅA <a href="../commandline/teraterm.html#f">/F</a> IvVͼÌIvVæèæÉ·é(㫳êé)æ¤ÉÏXµ½B</li> + <li>}NR}h "<a href="../macro/command/exec.html">exec</a>" ÉAN®µ½AvP[VÌI¹R[hð result Éi[·é½ßÌIvVðÇÁµ½B</li> </ul></li> <li>oOC³ Modified: trunk/doc/ja/html/macro/command/exec.html =================================================================== --- trunk/doc/ja/html/macro/command/exec.html 2009-05-19 11:26:12 UTC (rev 3412) +++ trunk/doc/ja/html/macro/command/exec.html 2009-05-19 13:28:06 UTC (rev 3413) @@ -18,7 +18,7 @@ </p> <pre class="macro-syntax"> -exec <command line> [<show>] +exec <command line> [<show> [<wait>]] </pre> <h2>ðà</h2> @@ -27,7 +27,7 @@ R}hC¶ñ <command line> É]¢AAvP[VðN®·éB </p> -showp[^ÉÍȺ̶ñðwè·é±ÆªÅ«éB +<show> p[^ÉÍȺ̶ñðwè·é±ÆªÅ«éB <pre> hide minimize @@ -35,6 +35,8 @@ show ;default parameters when no show command specified. </pre> +<wait> p[^É 1 ðwè·éÆAN®µ½AvP[VªI¹·éÜÅÒÂBAvP[VÌI¹R[hª result VXeÏÉi[³êéB<em>(o[W 4.63È~)</em> + <h2>á</h2> <pre class="macro-example"> Modified: trunk/teraterm/ttpmacro/ttl.c =================================================================== --- trunk/teraterm/ttpmacro/ttl.c 2009-05-19 11:26:12 UTC (rev 3412) +++ trunk/teraterm/ttpmacro/ttl.c 2009-05-19 13:28:06 UTC (rev 3413) @@ -18,6 +18,7 @@ #include "ttlib.h" #include "ttmenc.h" #include "tttypes.h" +#include <shellapi.h> // Oniguruma: Regular expression library #define ONIG_EXTERN extern @@ -787,6 +788,7 @@ { TStrVal Str,Str2; int mode = SW_SHOW; + int wait = 0, ret; WORD Err; Err = 0; @@ -806,6 +808,12 @@ mode = SW_SHOW; else Err = ErrSyntax; + + // get 3nd arg(optional) if given + if (CheckParameterGiven()) { + GetIntVal(&wait, &Err); + if (Err!=0) return Err; + } } if ((Err==0) && @@ -814,7 +822,20 @@ if (Err!=0) return Err; - WinExec(Str, mode); + if (!wait) { + WinExec(Str, mode); + } + else { + STARTUPINFO sui; + PROCESS_INFORMATION pi; + memset(&sui, 0, sizeof(STARTUPINFO)); + sui.cb = sizeof(STARTUPINFO); + sui.wShowWindow = mode; + CreateProcess(NULL, Str, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sui, &pi); + WaitForSingleObject(pi.hProcess, INFINITE); + GetExitCodeProcess(pi.hProcess, &ret); + SetResult(ret); + } return Err; }