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}});
有帮助吗?

解决方案

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.

其他提示

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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top