IMacros with proxy script

做~自己de王妃 提交于 2019-12-11 02:24:57

问题


Is there any way where we can change proxy in iMacros Firefox extension together with checking if the proxy is running or not??

Below is the code to change proxy, but cant figure out a way to check whether the proxy is running or not?

SET !ERRORIGNORE YES

SET !DATASOURCE proxies.csv

SET !DATASOURCE_COLUMNS 2

SET !LOOP 1

SET !DATASOURCE_LINE {{!LOOP}}

SET !TIMEOUT 60

CLEAR

'proxy module

URL GOTO=about:config

URL GOTO=javascript:varprefb=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);varstr=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);str.data="{{!COL1}}";prefb.setComplexValue("network.proxy.http",Components.interfaces.nsISupportsString,str);

URL GOTO=about:config

URL GOTO=javascript:gPrefBranch.setIntPref("network.proxy.http_port",{{!COL2}});

回答1:


http://wiki.imacros.net/PROXY

SET !ERRORIGNORE YES

SET !DATASOURCE proxies.csv

SET !DATASOURCE_COLUMNS 2

SET !DATASOURCE_LINE {{!LOOP}}

SET !TIMEOUT 60

CLEAR

PROXY ADDRESS={{!COL2}}) 

You can try it your way or this way.




回答2:


You can use JavaScript code for changing proxy address and port.

var ProxyIP = '121.43.146.196';
var ProxyPort = '1080';
Components.utils.import("resource://gre/modules/Services.jsm");
Services.prefs.setIntPref("network.proxy.type", 1);
Services.prefs.setCharPref("network.proxy.http", ProxyIP);
Services.prefs.setIntPref("network.proxy.http_port", ProxyPort);


来源:https://stackoverflow.com/questions/22743604/imacros-with-proxy-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!