运行 基于文本提取的宏
run macro based in texts extracted
我的英文不是很好,我希望能解释的最好
有什么方法可以运行基于提取文本的宏吗?
这段代码是测试,首先要做的是提取一个数字,如果数字匹配if (G_Extract!=="4")
执行宏调用"run"如果不匹配,重定向到google页面,问题是它执行所有代码而不重视 if (G_Extract!=="4")
并忽略 submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
iimPlay(submit)}
for (i = 0; i < 50000; i++) {
var verify;
verify = "CODE:";
verify += "URL GOTO=https://www.random.org/" + "\n";
verify += "FRAME F=1" + "\n";
verify += "TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:true-random-integer-generator-max CONTENT=5" + "\n";
verify += "TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:true-random-integer-generator-button" + "\n";
verify += "TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result EXTRACT=TXT" + "\n";
iimPlay(verify)
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
var Run;
Run = "CODE:";
Run += "URL GOTO=http://demo.imacros.net/Automate/Extract2" + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT" + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:H*links* EXTRACT=TITLE " + "\n";
Run += "TAG POS=1 TYPE=SPAN ATTR=CLASS:bdytxt&&TXT:* EXTRACT=HTM " + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=HREF " + "\n";
Run += "TAG POS=1 TYPE=IMG ATTR=SRC:*shark_thumbnail.jpg EXTRACT=ALT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:abc EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT " + "\n";
Run += "TAG POS=2 TYPE=TABLE ATTR=TXT:*My* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TH ATTR=TXT:MyTable" + "\n";
Run += "TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT" + "\n";
iimPlay(Run)
}
else
{var submit;
submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
iimPlay(submit)}
//New Step
iimPlay(verify)
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
iimPlay(Run)
}
else
{iimPlay(submit)}
//New Step
iimPlay(verify);
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
iimPlay(Run)
}
}
我检查了你的代码,我发现代码有两个问题,你在 else
块中定义了变量 submit
,所以它只能在 else 块和第二个块中使用错误是,在站点 random.org
中,当您单击生成按钮时,生成值需要一些时间,我认为 IMacros 不会等待您当前代码中接收到该值!为此,我建议添加一个 WAIT SECONDS=3
以便有足够的时间加载随机数。请在下面找到我更正后的代码!
IMACROS:
for (i = 0; i < 50000; i++) {
var verify;
verify = "CODE:";
verify += "URL GOTO=https://www.random.org/" + "\n";
verify += "FRAME F=1" + "\n";
verify += "TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:true-random-integer-generator-max CONTENT=5" + "\n";
verify += "TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:true-random-integer-generator-button" + "\n";
verify += "WAIT SECONDS=3" + "\n";
verify += "TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result EXTRACT=TXT" + "\n";
iimPlay(verify)
var submit;
submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
var Run;
Run = "CODE:";
Run += "URL GOTO=http://demo.imacros.net/Automate/Extract2" + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT" + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:H*links* EXTRACT=TITLE " + "\n";
Run += "TAG POS=1 TYPE=SPAN ATTR=CLASS:bdytxt&&TXT:* EXTRACT=HTM " + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=HREF " + "\n";
Run += "TAG POS=1 TYPE=IMG ATTR=SRC:*shark_thumbnail.jpg EXTRACT=ALT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:abc EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT " + "\n";
Run += "TAG POS=2 TYPE=TABLE ATTR=TXT:*My* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TH ATTR=TXT:MyTable" + "\n";
Run += "TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT" + "\n";
iimPlay(Run)
} else {
iimPlay(submit)
}
//New Step
iimPlay(verify)
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
iimPlay(Run)
} else {
iimPlay(submit)
}
//New Step
iimPlay(verify);
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
iimPlay(Run)
}
}
我的英文不是很好,我希望能解释的最好
有什么方法可以运行基于提取文本的宏吗?
这段代码是测试,首先要做的是提取一个数字,如果数字匹配if (G_Extract!=="4")
执行宏调用"run"如果不匹配,重定向到google页面,问题是它执行所有代码而不重视 if (G_Extract!=="4")
并忽略 submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
iimPlay(submit)}
for (i = 0; i < 50000; i++) {
var verify;
verify = "CODE:";
verify += "URL GOTO=https://www.random.org/" + "\n";
verify += "FRAME F=1" + "\n";
verify += "TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:true-random-integer-generator-max CONTENT=5" + "\n";
verify += "TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:true-random-integer-generator-button" + "\n";
verify += "TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result EXTRACT=TXT" + "\n";
iimPlay(verify)
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
var Run;
Run = "CODE:";
Run += "URL GOTO=http://demo.imacros.net/Automate/Extract2" + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT" + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:H*links* EXTRACT=TITLE " + "\n";
Run += "TAG POS=1 TYPE=SPAN ATTR=CLASS:bdytxt&&TXT:* EXTRACT=HTM " + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=HREF " + "\n";
Run += "TAG POS=1 TYPE=IMG ATTR=SRC:*shark_thumbnail.jpg EXTRACT=ALT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:abc EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT " + "\n";
Run += "TAG POS=2 TYPE=TABLE ATTR=TXT:*My* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TH ATTR=TXT:MyTable" + "\n";
Run += "TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT" + "\n";
iimPlay(Run)
}
else
{var submit;
submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
iimPlay(submit)}
//New Step
iimPlay(verify)
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
iimPlay(Run)
}
else
{iimPlay(submit)}
//New Step
iimPlay(verify);
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="4")
{
iimPlay(Run)
}
}
我检查了你的代码,我发现代码有两个问题,你在 else
块中定义了变量 submit
,所以它只能在 else 块和第二个块中使用错误是,在站点 random.org
中,当您单击生成按钮时,生成值需要一些时间,我认为 IMacros 不会等待您当前代码中接收到该值!为此,我建议添加一个 WAIT SECONDS=3
以便有足够的时间加载随机数。请在下面找到我更正后的代码!
IMACROS:
for (i = 0; i < 50000; i++) {
var verify;
verify = "CODE:";
verify += "URL GOTO=https://www.random.org/" + "\n";
verify += "FRAME F=1" + "\n";
verify += "TAG POS=1 TYPE=INPUT:NUMBER ATTR=ID:true-random-integer-generator-max CONTENT=5" + "\n";
verify += "TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:true-random-integer-generator-button" + "\n";
verify += "WAIT SECONDS=3" + "\n";
verify += "TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result EXTRACT=TXT" + "\n";
iimPlay(verify)
var submit;
submit = "CODE:";
verify += "URL GOTO=http://www.google.com/" + "\n";
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
var Run;
Run = "CODE:";
Run += "URL GOTO=http://demo.imacros.net/Automate/Extract2" + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT" + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:H*links* EXTRACT=TITLE " + "\n";
Run += "TAG POS=1 TYPE=SPAN ATTR=CLASS:bdytxt&&TXT:* EXTRACT=HTM " + "\n";
Run += "TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=HREF " + "\n";
Run += "TAG POS=1 TYPE=IMG ATTR=SRC:*shark_thumbnail.jpg EXTRACT=ALT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=NAME:abc EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:TF2 EXTRACT=TXT " + "\n";
Run += "TAG POS=2 TYPE=TABLE ATTR=TXT:*My* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:* EXTRACT=TXT " + "\n";
Run += "TAG POS=1 TYPE=TH ATTR=TXT:MyTable" + "\n";
Run += "TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT" + "\n";
iimPlay(Run)
} else {
iimPlay(submit)
}
//New Step
iimPlay(verify)
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
iimPlay(Run)
} else {
iimPlay(submit)
}
//New Step
iimPlay(verify);
var G_Extract = iimGetLastExtract(1);
if (G_Extract !== "4") {
iimPlay(Run)
}
}