vasu Posted November 18, 2009 Share Posted November 18, 2009 Hi, I'm writing a script to switch on/off proxy connections setting within Firefox. At work, i must enabled it to browse websites and at home i need to have it disabled. The Advanced option under Firefox Options does not accept CTRL+TAB based switching and also the window position isn't static. Is there anyway to get to Connection Settings (Firefox->Tools->Options->Advanced->Network->Settings) window using AutoIt functions? FYI, I'm running Firefox v3.5.5 on Windows 7. Appreciate your help. Thanks and Regards, Vasu Link to comment Share on other sites More sharing options...
Uriziel01 Posted November 18, 2009 Share Posted November 18, 2009 It has been already done my friend Look into this thread http://www.autoitscript.com/forum/index.php?showtopic=70821&st=220&p=682141&hl=FF%20proxy&fromsearch=1&#entry682141 Link to comment Share on other sites More sharing options...
vasu Posted November 18, 2009 Author Share Posted November 18, 2009 (edited) Thanks for the quick response. This is exactly what i was looking for. I downloaded the FF.au3 script from http://thorsten-willert.de/Themen/FFau3/FF.au3/FF.au3 and included it in my script, but somehow the connection to firefox is never established. I run the below simple example script and i always get message "Can't connect to firefox". #Include <FF.au3> _FFStart("about:blank") ; trying to connect to a running FireFox with MozRepl on If _FFConnect(Default, Default, 3000) Then ; open a page _FFOpenURL("http://ff-au3-example.thorsten-willert.de/") Sleep(3000) ; disconnect from FireFox If _FFDisConnect() Then MsgBox(64, "", "Disconnected from FireFox!") Else MsgBox(64, "", "Can't connect to FireFox!") EndIf I tested after disabling my firewall and changing from "Default localhost" to my actual physical IP but still the same response. I even disabled all Firefox add-ons and still no use. Below is the log report: >Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\Vasu\Desktop\test.au3" __FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "about:blank" -repl 4242 _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect ==> Timeout: TCPConnect Error: 10061 _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect ==> General Error: Timeout: Can not connect to FireFox/MozRepl on: 127.0.0.1:4242 _FFConnect: Delay: 2ms _FFConnect ==> Timeout: TCPConnect Error: 10061 _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect ==> General Error: Timeout: Can not connect to FireFox/MozRepl on: 127.0.0.1:4242 _FFConnect ==> Timeout: TCPConnect Error: 10061 _FFConnect ==> General Error: Timeout: Can not connect to FireFox/MozRepl on: 127.0.0.1:4242 +>18:14:56 AutoIT3.exe ended.rc:0 +>18:14:57 AutoIt3Wrapper Finished >Exit code: 0 Time: 74.767 What else i am missing? Thanks and Regards, Vasu Edited November 18, 2009 by vasu Link to comment Share on other sites More sharing options...
vasu Posted November 18, 2009 Author Share Posted November 18, 2009 I just realized that i need mozrepl add-on to be available before i can use it with FF.AU3 script. I can't seem to find it for my version of firefox (v3.5.5)? I already checked http://wiki.github.com/bard/mozrepl and it isn't compatiable with 3.5.5 version of firefox. Any ideas from where i can get it? Thanks and Regards, Shrini Link to comment Share on other sites More sharing options...
Stilgar Posted November 19, 2009 Share Posted November 19, 2009 I just realized that i need mozrepl add-on to be available before i can use it with FF.AU3 script. I can't seem to find it for my version of firefox (v3.5.5)? I already checked http://wiki.github.com/bard/mozrepl and it isn't compatiable with 3.5.5 version of firefox.Any ideas from where i can get it?Thanks and Regards,ShriniAre you sure that it is incompatible? http://repo.hyperstruct.net/mozrepl/1.0/mozrepl.xpiMozRepl works with FF V3.5.*Here it works with FireFox V3.5.5, too. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 Yes, I'm running Firefox v3.5.5 (Check the below screenshots). Everytime I try to install I keep getting error message "Not a Valid Install Package". Thanks and Regards, Vasu Link to comment Share on other sites More sharing options...
Stilgar Posted November 19, 2009 Share Posted November 19, 2009 Yes, I'm running Firefox v3.5.5 (Check the below screenshots). Everytime I try to install I keep getting error message "Not a Valid Install Package".Thanks and Regards,VasuMaybe a download problem. I've uploaded it there:http://thorsten-willert.de/Themen/FFau3/Verschiedenes/mozrepl.xpi jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 I'm sorry but, I was able to successfully install MozRepl add-on. But, launching direct url causes the error where as saving the file locally and then installing works fine. Thanks again. Regards, Vasu Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 BTW, is there any such direct function available to set proxy within IE like we have for FF3.au3? Thanks and Regards, Vasu Link to comment Share on other sites More sharing options...
Uriziel01 Posted November 19, 2009 Share Posted November 19, 2009 HttpSetProxy ???? Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 No, HttpSetProxy function didn't help. Not sure if this is the optimum way, but I'm now doing it in following way right now: $proxy_addr = "www.proxy-server.com:8080" RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", $flag ) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", $proxy_addr) Thanks and Regards, Vasu Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 I'm getting error messages when I run below simple script: #include <FF.au3> _FFStart("about:blank") _FFConnect(Default, Default, 3000) If _FFIsConnected() Then _FFPrefSet("network.proxy.type", 1) ;1 = Manual proxy configuration _FFPrefSet("network.proxy.http", "proxy-server.com") ;http proxy _FFPrefSet("network.proxy.http_port", 8080) ;http proxy port _FFQuit() ;_FFDisConnect() EndIf Error Log: expandcollapse popup>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\My Documents\ Vasu\AutoIT Scripts\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>15:53:31 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X64 OS:X86) >Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3 +>15:53:31 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "D:\My Documents\ Vasu\AutoIT Scripts\test.au3" __FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "about:blank" -repl 4242 _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 536 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 __FFSendJavascripts: Sending functions to FireFox .......... done _FFLoadWait: . loaded in 31ms _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 564 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 __FFSendJavascripts: Sending functions to FireFox .......... done __FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj.getCharPref("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: proxy-server.com __FFSend: try{FFau3.obj.setCharPref("network.proxy.http","proxy-server.com");}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj.getCharPref("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: proxy-server.com __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj.getIntPref("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 8080 __FFSend: try{FFau3.obj.setIntPref("network.proxy.http_port",8080);}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj.getIntPref("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 8080 +>15:53:37 AutoIT3.exe ended.rc:0 +>15:53:38 AutoIt3Wrapper Finished >Exit code: 0 Time: 7.417 Why is this happening? Thanks and Regards, Vasu Link to comment Share on other sites More sharing options...
Stilgar Posted November 19, 2009 Share Posted November 19, 2009 I'm getting error messages when I run below simple script: #include <FF.au3> _FFStart("about:blank") _FFConnect(Default, Default, 3000) If _FFIsConnected() Then _FFPrefSet("network.proxy.type", 1) ;1 = Manual proxy configuration _FFPrefSet("network.proxy.http", "proxy-server.com") ;http proxy _FFPrefSet("network.proxy.http_port", 8080) ;http proxy port _FFQuit() ;_FFDisConnect() EndIf Error Log: expandcollapse popup>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\My Documents\ Vasu\AutoIT Scripts\test.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>15:53:31 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X64 OS:X86) >Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3 +>15:53:31 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "D:\My Documents\ Vasu\AutoIT Scripts\test.au3" __FFStartProcess: ""C:\Program Files\Mozilla Firefox\firefox.exe" -new-window "about:blank" -repl 4242 _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 536 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 __FFSendJavascripts: Sending functions to FireFox .......... done _FFLoadWait: . loaded in 31ms _FFConnect: OS: WIN_VISTA WIN32_NT 7600 _FFConnect: AutoIt: 3.3.0.0 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 564 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 __FFSendJavascripts: Sending functions to FireFox .......... done __FFSend: try{FFau3 != null?1:0}catch(e){'_FFCmd_Err';}; __FFRecv: 1 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj.getCharPref("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: proxy-server.com __FFSend: try{FFau3.obj.setCharPref("network.proxy.http","proxy-server.com");}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: 32 __FFSend: try{FFau3.obj.getCharPref("network.proxy.http");}catch(e){'_FFCmd_Err';}; __FFRecv: proxy-server.com __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj.getIntPref("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 8080 __FFSend: try{FFau3.obj.setIntPref("network.proxy.http_port",8080);}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{FFau3.obj=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); FFau3.obj.getPrefType("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 64 __FFSend: try{FFau3.obj.getIntPref("network.proxy.http_port");}catch(e){'_FFCmd_Err';}; __FFRecv: 8080 +>15:53:37 AutoIT3.exe ended.rc:0 +>15:53:38 AutoIt3Wrapper Finished >Exit code: 0 Time: 7.417 Why is this happening? Thanks and Regards, Vasu I can't see any error message. There's only the communication-protocol between the FF.au3 and MozRepl/FireFox. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
vasu Posted November 19, 2009 Author Share Posted November 19, 2009 Then what is '_FFCmd_Err' about? Link to comment Share on other sites More sharing options...
Stilgar Posted November 19, 2009 Share Posted November 19, 2009 Then what is '_FFCmd_Err' about?This is "send" to FireFox e.g.__FFSend: try{FFau3.obj.getIntPref("network.proxy.http_port");}catch(e){'_FFCmd_Err';};All commands are send in Javascript. '_FFCmd_Err' would returned from the "catch" if any error appears. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now