DoctorWho Posted August 9, 2011 Share Posted August 9, 2011 I need a bit of help - is there a way to test to see if Internet Explorer is set as the default browser? We have a few applications that require ActiveX and therefore Internet Explorer and I would like to change my current installation script to display a message if the user has anything other than IE as their default browser - I don't want to change it for them, just let them know that some applications will not work correctly without IE as the default browser. Thanks in advance for any assistance. Link to comment Share on other sites More sharing options...
UEZ Posted August 9, 2011 Share Posted August 9, 2011 (edited) Here is a good description which registry values you need to check: http://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/ or ask Google Br, UEZ Edited August 9, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
DoctorWho Posted August 9, 2011 Author Share Posted August 9, 2011 Thanks UEZ, I'll check it out.. Link to comment Share on other sites More sharing options...
wakillon Posted August 9, 2011 Share Posted August 9, 2011 You can try this ConsoleWrite ( "-->-- Defaut Browser Path : " & _GetDefaultBrowser ( ) & @Crlf ) Func _GetDefaultBrowser ( ) $_DefautBrowser = StringRegExp ( RegRead ( "HKEY_CLASSES_ROOT\http\shell\open\command", "" ), '(?s)(?i)"(.*?)"', 3 ) If Not @error Then Return $_DefautBrowser[0] EndFunc ;==> _GetDefaultBrowser ( ) AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
GEOSoft Posted August 9, 2011 Share Posted August 9, 2011 (edited) I may as well throw in my 2 cents ConsoleWrite("IE is default = " & _IEisDefault() & @CRLF) Func _IEisDefault() Return StringRegExp(RegRead("HKCR\http\shell\open\command", ""), "(?i)^.+iexplore\.exe.+$", 0) EndFunc Edited August 9, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
jvanegmond Posted August 9, 2011 Share Posted August 9, 2011 I may as well throw in my 2 cents ConsoleWrite("IE is default = " & _IEisDefault() & @CRLF) Func _IEisDefault() Return StringRegExp(RegRead("HKCR\http\shell\open\command"), "(?i)^.+iexplore\.exe.+$", 0) EndFunc RegRead takes 2 parameters, and there is no need for the regexp when StringInStr is enough. github.com/jvanegmond Link to comment Share on other sites More sharing options...
GEOSoft Posted August 9, 2011 Share Posted August 9, 2011 Yes, I had better correct that. StringInStr will work but not with a single call making the return. In his case StringInStr() would return 37. I want it to return 1 or 0 and still do it in a single call. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
JohnOne Posted August 9, 2011 Share Posted August 9, 2011 (edited) If I read that article correctly, win xp sets the default browser for (edit)all users Here;s what I got got 7 and vista. MsgBox(0, 0, _DefaultBrowser()) Func _DefaultBrowser() ;TODO Get path for winxp If @OSVersion = "WIN_7" Or @OSVersion = "WIN_VISTA" Then $sRegPath = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\" Else Return "WIN_XP" EndIf Return StringReplace(RegRead($sRegPath, "Progid"), "URL", "") EndFunc ;==>_DefaultBrowser Edited August 9, 2011 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jvanegmond Posted August 9, 2011 Share Posted August 9, 2011 (edited) Yes, I had better correct that. StringInStr will work but not with a single call making the return.In his case StringInStr() would return 37. I want it to return 1 or 0 and still do it in a single call.Bad excuse for more complicated (harder to read, and slower) code. There is no 1 vs. 0 requirement. Function success: Non-zero. Failure: Zero. Very C++. Edited August 9, 2011 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
GEOSoft Posted August 9, 2011 Share Posted August 9, 2011 (edited) Then write it in C++. It won't bother me one bit. Harder to read? Slower? Hmmmmmm, maybe not. Edited August 9, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
sticks221 Posted September 10, 2012 Share Posted September 10, 2012 (edited) I appreciate that this is an old post but thought that any others stuggling to find a solution to this might appricate the solution I have come up with after much searching, playing and testing. This solution works on Windows XP, 7 (32bit) and 7 (64bit);[size=4][font=arial,helvetica,sans-serif]Func _GetDefaultBrowser() local $browserTest1 = RegRead("HKEY_CURRENT_USERSoftwareClientsStartMenuInternet","") local $browserTest2 = RegRead("HKEY_CLASSES_ROOThttpshellopencommand","")[/font][/size] [size=4][font=arial,helvetica,sans-serif] if not $browserTest1 = "" Then $browser = $browserTest1 Else $browser = $browserTest2 endif[/font][/size] [size=4][font=arial,helvetica,sans-serif] Select case StringInStr($browser,"IExplore") return "Internet Explorer V" & RegRead("HKEY_LOCAL_MACHINESoftwareMicrosoftInternet Explorer","version") case StringInStr($browser,"Chrome") return "Chrome V" & RegRead("HKEY_CURRENT_USERSoftwareGoogleUpdate","version") case StringInStr($browser,"Firefox") return "Firefox V" & RegRead("HKEY_LOCAL_MACHINESoftwareMozillaMozilla Firefox","CurrentVersion") case StringInStr($browser,"Opera") return "Opera V" & FileGetVersion (RegRead("HKEY_CURRENT_USERSoftwareOpera Software","Last CommandLine v2")) case StringInStr($browser,"Safari") return "Safari V" & RegRead("HKEY_LOCAL_MACHINESoftwareApple Computer, Inc.Safari","version") case Else return "Unsupported (" & $Browser & ")" EndSelect EndFunc[/font][/size] [size=4][font=arial,helvetica,sans-serif](This is my first post so apologies if the code post doesnt come out as planned!) Edited September 10, 2012 by sticks221 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