/docs/commands/WinSetTitle.htm

http://autohotkey-chinese.googlecode.com/ · HTML · 56 lines · 50 code · 6 blank · 0 comment · 0 complexity · 60d1cfc6d805ce6ef29ecc33e6cf3a38 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>WinSetTitle</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7. <link href="../css/commands.css" rel="stylesheet" type="text/css">
  8. <link href="../css/print.css" rel="stylesheet" type="text/css" media="print">
  9. </head>
  10. <body>
  11. <h1>WinSetTitle</h1>
  12. <p>改变匹配指定条件的窗口的标题</p>
  13. <p class="CommandSyntax">WinSetTitle, NewTitle<br>
  14. WinSetTitle, WinTitle, WinText, NewTitle [, ExcludeTitle, ExcludeText] </p>
  15. <h3>参数 </h3>
  16. <table border="1" width="100%" cellspacing="0" cellpadding="3" bordercolor="#C0C0C0">
  17. <tr>
  18. <td width="15%">NewTitle</td>
  19. <td width="85%">目标窗口的新标题如果只指定这一个参数其它参数省略默认目标是 <a href="../LastFoundWindow.htm">上一次匹配窗口</a> </td>
  20. </tr>
  21. <tr>
  22. <td>WinTitle</td>
  23. <td>目标窗口的标题或标题中的部分文字匹配模式由 <a href="SetTitleMatchMode.htm">SetTitleMatchMode</a> 决定如果省略其它 3 个参数默认目标是 <a href="../LastFoundWindow.htm">上一次匹配窗口</a> 如果这个参数使用字母 A 同时省略其它 3 个参数则以当前激活的窗口作为目标要用窗口的 class 名进行匹配使用 <em>ahk_class 精确 class </em>Window Spy 中可以显示 class 要用窗口的 <a href="Process.htm">进程标识符PID</a>进行匹配使用 <em>ahk_pid %PID变量%</em> 要用 <a href="GroupAdd.htm">窗口组</a> 使用 <em>ahk_group 组名</em> 要用窗口的 <a href="WinGet.htm">唯一 ID</a> 进行匹配使用 <em>ahk_id %ID变量%</em> 要减小检测范围使用 <a href="../LastFoundWindow.htm#multi">多重条件</a> 例如<em>My File.txt ahk_class Notepad</em></td>
  24. </tr>
  25. <tr>
  26. <td>WinText</td>
  27. <td>如果使用这个参数则它应该是目标窗口中某个文本元素的子字符串 Window Spy 中会显示出窗口中的文本元素隐藏文本只有在 <a href="DetectHiddenText.htm">DetectHiddenText</a> 设置为 ON 的时候才能检测到</td>
  28. </tr>
  29. <tr>
  30. <td>ExcludeTitle</td>
  31. <td>标题中包含该参数指定的文字的窗口将被除外</td>
  32. </tr>
  33. <tr>
  34. <td>ExcludeText</td>
  35. <td>文本元素中包含该参数指定的文字的窗口将被除外</td>
  36. </tr>
  37. </table>
  38. <h3>注意</h3>
  39. <p>如果窗口所在的程序本身经常修改窗口的标题那么该命令对窗口标题的修改就只能是暂时的</p>
  40. <p>窗口的标题和窗口中的文字是大小写敏感的要检测隐藏窗口必须打开 <a href="DetectHiddenWindows.htm">DetectHiddenWindows</a> </p>
  41. <h3>相关命令</h3>
  42. <p><a href="WinMove.htm">WinMove</a>, <a href="WinGetActiveStats.htm">WinGetActiveStats</a>, <a href="WinGetActiveTitle.htm">WinGetActiveTitle</a>, <a href="WinGetText.htm">WinGetText</a>, <a href="ControlGetText.htm">ControlGetText</a>, <a href="WinGetPos.htm">WinGetPos</a>, <a href="WinSet.htm">WinSet</a></p>
  43. <h3>示例</h3>
  44. <pre class="NoIndent">WinSetTitle, Untitled - Notepad, , This is a new title
  45. <em>; 另一个修改记事本标题的例子</em>
  46. Run, notepad.exe
  47. WinWaitActive, Untitled - Notepad
  48. WinSetTitle, This is a new title <em>; 使用上面 WinWaitActive 找到的窗口</em></pre>
  49. </body>
  50. </html>