imacros函数iimPlay()丢失以前建立的代理连接

时间:2015-10-24 00:33:23

标签: javascript jquery ajax proxy imacros

此脚本从列表中选择随机代理,然后转到网站以确认代理能够访问Internet。如果网站成功加载,则继续加载另一个.iim文件

问题是在这里执行iimPlay()时代理连接丢失了:

iimPlay(part2);  // at this point the proxy connection is established
iimPlay("C:\Users\Libertad\Documents\iMacros\Macros\test.iim");

如何在iimPlay()完成之前保持代理连接?并且不会在我的.js中复制所有单独的.iim文件(关键是要有一个“启动器”文件,它将连接并验证代理,然后运行任何宏文件)

var macro = "CODE:";
macro += "VERSION BUILD=8940826 RECORDER=FX" + "\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAB T=1" + "\n";
macro += "CLEAR" + "\n";
macro += "SET !FILESTOPWATCH mydata.csv" + "\n";
macro += "STOPWATCH ID=total" + "\n";
macro += "SET !DATASOURCE C:\\proxies.csv" + "\n";
macro += "SET !DATASOURCE_COLUMNS 1" + "\n";
macro += "SET !LOOP 1" + "\n";
macro += "SET !VAR9 {{rnd}}" + "\n";
macro += "SET !DATASOURCE_LINE {{!VAR9}}" + "\n";
macro += "SET !TIMEOUT 30" + "\n";
macro += "PROXY ADDRESS={{!COL1}}" + "\n";
macro += "URL GOTO=http://www.alterweb.ca/ip.php?csv=ligne{{!VAR9}}" + "\n";
macro += "WAIT SECONDS=3" + "\n";


var part2 = "CODE:";
part2 += "VERSION BUILD=8940826 RECORDER=FX" + "\n";
part2 += "SET !ERRORIGNORE YES" + "\n";
part2 += "SET !DATASOURCE C:\\proxies.csv" + "\n";
part2 += "SET !DATASOURCE_COLUMNS 1" + "\n";
part2 += "SET !DATASOURCE_LINE {{line}}" + "\n";
part2 += "PROXY ADDRESS={{!COL1}}" + "\n";
part2 += "WAIT SECONDS=6" + "\n";


var big_count=parseFloat(prompt("loops=?",1000));
var fichier=parseFloat(prompt("fichier imacro","C:\\Users\\Libertad\\Documents\\iMacros\\Macros\\test.iim"));


for(var x=0;x<big_count;x++)
{
    var rand=Math.floor(Math.random()*2000 + 1);
    iimSet("rnd",rand);
    iimPlay(macro);

    if(window.content.document.body.textContent.contains('proxy'))
    {
        //if proxy word found
        iimSet("line",rand);
        iimPlay(part2);  // at this point the proxy connection is established
        iimPlay("C:\Users\Libertad\Documents\iMacros\Macros\test.iim");

    }   
    else
    {
        //if proxy word isn't found
    }

}

1 个答案:

答案 0 :(得分:1)

查看此代码段的工作原理:

var prefs = imns.Pref;
var proxy = "123.456.789.123";
var port = "1234":
prefs.setCharPref("network.proxy.http", proxy, true);
prefs.setIntPref("network.proxy.http_port", port, true);

我希望您能找到将其应用到脚本的方法。