//条件等待 //WaitColor //失败执行语句 //循环执行语句Touch X= Y= //.... //若超时未满足则执行下1句,第二句为每秒循环执行,否则下3句开始 public static void Parse_WaitColor(ref int index) { string str = lstScript[index]; if (str.IndexOf("WaitColor") == 0) { int t, x, y, r, g, b; Regex reg = new Regex("T=(?<t>\\d+).*.X=(?<x>\\d+).*.Y=(?<y>\\d+).*.R=(?<r>\\d+).*.G=(?<g>\\d+).*.B=(?<b>\\d+)"); Match m = reg.Match(str); t = int.Parse(m.Groups["t"].Value); x = int.Parse(m.Groups["x"].Value); y = int.Parse(m.Groups["y"].Value); r = int.Parse(m.Groups["r"].Value); g = int.Parse(m.Groups["g"].Value); b = int.Parse(m.Groups["b"].Value); t /= 1000; while (--t >= 0) { SysMsg.ShotEvent(); bmp = Tcp.GetBitmap(); frm.ImgUpdateFunction(bmp); if (PointColorAEqual(x, y, r, g, b)) { index += 4; return; } string str1; if (t % 2 == 0) { str1 = lstScript[index + 2]; } else { str1 = lstScript[index + 3]; } if (str1.IndexOf("Touch") == 0) { Regex reg1 = new Regex("X=(?<x>\\d+).*.Y=(?<y>\\d+)"); Match m1 = reg1.Match(str1); int x1 = int.Parse(m1.Groups["x"].Value); int y1 = int.Parse(m1.Groups["y"].Value); SysMsg.MouseEvent(0, x1, y1); Thread.Sleep(1); SysMsg.MouseEvent(1, x1, y1); } Thread.Sleep(1000); } //失败执行下一句 index++; } }
//更新图像 //UpdataImg public static void Parse_UpdataImg(ref int index) { string str = lstScript[index]; if (str.IndexOf("UpdataImg") == 0) { SysMsg.ShotEvent(); bmp = Tcp.GetBitmap(); frm.ImgUpdateFunction(bmp); index++; } }