I can't use imacros to change proxy value in about:config from firefox 34
myproxy.iim
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="IP HERE";prefb.setComplexValue("network.proxy.http",Components.interfaces.nsISupportsString,str);
URL GOTO=about:config URL GOTO=javascript:gPrefBranch.setIntPref("network.proxy.http_port",PORT HERE);
URL GOTO=about:config URL GOTO=javascript:gPrefBranch.setIntPref("network.proxy.type",1);
I try above script many times for imacros but it doesn't work in about:config of firefox 34. Please tell me the way to resolve my problem. Thanks a lot URL GOTO=about:config URL GOTO=javascript:gPrefBranch.setIntPref("network.proxy.type",1);
Modified
All Replies (6)
I notice a missing space in varprefb -> var prefb and varstr -> var str
varprefb=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
Note that such issues can happen if you paste text that have line breaks in a single line text field
var prefb=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
You can check the editor.singleLine.pasteNewlines pref on the about:config page.
Modified
Thank you for your answer, but I haven't still resolved my problem
I access "about:config" in firefox. How can I modify "network.proxy.type 0" => "network.proxy.type 1" "network.proxy.socks 0" => "network.proxy.socks 64.31.22.131" "network.proxy.socks_port 0" => "network.proxy.socks 3127"
by using javascript code
Thank you a lot
You can use the pref service to modify prefs. You do not need the about:config page.
cor-el said
You can use the pref service to modify prefs. You do not need the about:config page.
I use below javascript code, but I could not change "network.proxy.http" in about:config firefox 34.
proxy.php <head> <script type="text/javascript">
function myfunction(){
var prefs=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
str.data="183.20.0.1"; prefs.setComplexValue("network.proxy.http",Components.interfaces.nsISupportsString,str);
</script> </head> <body> <button onclick="myfunction();">Click here</button> </body> </html>
Could you please give me an detailed example? Thank you a lot
I'm not familiar with the iMacro extension, so it is possible that the above posted code stops working for other reasons and that the var prefix is there on purpose (based on convention), so I may have been wrong there.
I'm not sure what you intend to do with that network.proxy.http pref as it doesn't seem to exist for me on the about:config page and 183.20.0.1 is a normal String value that shouldn't require a complex value (setCharPref() would do).
See also:
- https://developer.mozilla.org/Mozilla/Tech/XPCOM/Reference/Interface/nsIPrefBranch#setComplexValue()
You can check the Browser Console (Firefox/Tools > Web Developer) for error messages.
You would have to contact the iMacro author for support if the extension isn't working properly.
Thank you a lot for your answers. Have a good day