【发布时间】:2014-01-09 15:22:41
【问题描述】:
我正在编写一个 C++ iMacro 脚本,该脚本将登录到网站、转到特定页面并查找复选框。如果复选框不存在,则脚本将每 X 秒刷新一次页面。如果复选框确实存在,那么它将选中它。基本上我只需要弄清楚如何让 iMacro 搜索复选框。到目前为止,这是我的代码:
using namespace System;
#include <string>
int timeout = 60;
ref class ManagedGlobals {
public:
static iMacros::AppClass^ app;
};
// test if element exists
bool doesElementExist() {
iMacros::Status stat;
ManagedGlobals::app->iimDisplay("Searching for element", timeout);
stat = ManagedGlobals::app->iimPlay("CODE:SET !TIMEOUT_TAG 1\n"
+ "CODE:TAG POS=8 TYPE=INPUT:CHECKBOX FORM=ACTION:/pls/PROD/bwykfreg.P_AltPin1?deviceType=C ATTR=NAME:sel_crn EXTRACT=TXT", timeout);
ManagedGlobals::app->iimDisplay(stat.ToString(), timeout);
ManagedGlobals::app->iimPlay("CODE:WAIT SECONDS=10", timeout);
if (stat != iMacros::Status::sOk) {
ManagedGlobals::app->iimDisplay("Didn't find it", timeout);
return false;
}
ManagedGlobals::app->iimDisplay("Found it", timeout);
return true;
}
我已经在页面上对此进行了测试,该复选框确实存在,但脚本无法找到它,而是返回错误代码 -1100,根据this page 这意味着Load Failed: Failed to load the macro (syntax or I/O error) (Found wrong macro command while loading file).
有谁知道问题出在哪里?
【问题讨论】:
标签: c++ checkbox macros imacros