iMacros的。 我必须找到一个网站的邀请代码,它是一个包含字母(a-z)和数字(0-9)的代码。有3个缺失,例如XXX。但是,我如何制作一个" for"在Imacros上体贴字母和数字?我必须使用javascript?
这是我的代码:
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=(url site)
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:confirmcod.php ATTR=NAME:cod CONTENT=123XXXabc
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:confirmcod.php ATTR=*
答案 0 :(得分:1)
在不使用Javascript的情况下执行此操作的一种方法是预加载具有链接的所有可能组合的数据源。迭代此文档,直到找到正确的链接。
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE c:\mysource
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=(url site)
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:confirmcod.php ATTR=NAME:cod CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:confirmcod.php ATTR=*
Wiki page for iMacro Datasource。
如果您想使用javascript,则需要使用iimPlay动态生成宏代码。下面的示例迭代检查随机字符串,直到iMacros返回1或sOK。
// possible keys for the link
var keys = '0123456789abcdefghijklmnopqrstuvwxyz';
// array to store past keys
var keyArray = [];
var myKey = "";
var i, j, k = 0;
var pageNotFound = true;
var macro = "";
var retCode = 0;
var myURL = "http://www.google.com";
do
{
i = keys.charAt(Math.floor(Math.random()*keys.length))
j = keys.charAt(Math.floor(Math.random()*keys.length));
k = keys.charAt(Math.floor(Math.random()*keys.length));
myKey = i + j + k;
if (keyArray.indexOf(myKey, 0) < 0)
{
keyArray.push(myKey);
// run imacro code with this key
macro = "CODE:";
macro += "TAB T=1\n";
macro += "TAB CLOSEALLOTHERS\n";
macro += "URL GOTO=" + myURL + "\n";
macro += "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT=" + myKey + "\n";
macro += "TAG POS=1 TYPE=BUTTON FORM=ID:gbqf ATTR=ID:gbqfb\n";
retCode = iimPlay(macro);
// check if the page is found
if (retCode)
{
// if page is found set pageNotFound = false;
pageNotFound = false;
}
} else {
// key has been used already, try a different one.
}
} while(pageNotFound);