换了个函数重新写了一下,还是一样的情况,求指点
macro_command main()
char ori[20], search[20]
char res1[26] = "搜索完成,已找到搜索结果!"
char res2[26] = "搜索完成,未找到搜索结果!"
int start = 0
int count = 0
bool result = false
//获取搜索关键词
GetData(search[0], "Local HMI", LW, 10, 20)
//获取配方数量
RecipeQuery("SELECT * FROM canshu", count)
//循环对比每笔数据的mingcheng与输入是否相同
for start = 0 to count - 1
result = RecipeQueryGetData(ori[0], "canshu.mingcheng", start)
if(search[0] == ori[0])then
SetData(res1[0], "Local HMI", LW, 20, 26)
//选中当前位置
SetData(start, "Local HMI", RECIPE, "canshu.Selection")
break
else if start == count - 1 then
SetData(res2[0], "Local HMI", LW, 20, 26)
end if
next start
end macro_command |