![](https://csdnimg.cn/release/download_crawler_static/87616912/bg5.jpg)
� // 设置 false,获取 ctrl+c
� crt.Screen.IgnoreEscape = false;
� crt.Dialog.MessageBox(crt.Screen.ReadString("\03"));
�
� // 设置 true,不获取 ctrl+c
� crt.Screen.IgnoreEscape = true;
crt.Dialog.MessageBox(crt.Screen.ReadString("\03"));
2.1.6、MatchIndex
解释
当使用 WaitForStrings 和 ReadString 这两个方法获取字符串时,会根据参数的
位置获取返回值,而 MatchIndex 就是这个位置,从 1 开始计算,如果没有一个
匹配到则返回 0,可以根据下面的例子来看。
语法
crt.Screen.MatchIndex
代码
� JS
# $language = "JScript"
# $interface = "1.0"
var outPut = crt.Screen.ReadString("error", "warning", "#", 10);
switch (crt.Screen.MatchIndex) {
case 0:
crt.Dialog.MessageBox("Timed out!")
break;
case 1:
crt.Dialog.MessageBox("Found 'error'")
break;
case 2:
crt.Dialog.MessageBox("Found 'warning'")