Sign in to follow this  
Followers 0
JScript

_GetDefBrowser.au3 (UDF) - Get the name of the default browser.

16 posts in this topic

#1 ·  Posted (edited)

Hello everyone!

I made this UDF to get the name of the default browser!

Updated: SmOke_N in StringRegExp()

_GetDefBrowser.au3 - Source:

#include-once
; #INDEX# =======================================================================================================================
; Title .........: _GetDefBrowser
; AutoIt Version : 3.3.0.0++
; Language ......: English
; Description ...: Get default file browser name with extension.
; Author(s) .....: João Carlos (jscript) - DVI-Informática™ 2008.6-2011.4, dvi-suporte@hotmail.com
; Dll(s) ........:
; ===============================================================================================================================

; #VARIABLES# ===================================================================================================================
;================================================================================================================================

; #CURRENT# =====================================================================================================================
; _GetDefBrowser
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
;================================================================================================================================

; #FUNCTION# ====================================================================================================================
; Name ..........: _GetDefBrowser
; Description ...: Get default file browser name with extension.
; Syntax ........: _GetDefBrowser(  )
; Parameters ....: None
; Return values .: Success  - Return Default browser name with extension.
;                  Failure  - Return "" (Empty string)
; Author(s) .....: João Carlos (Jscript FROM Brazil)
; Modified ......: SmOke_N (StringRegExp)
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: MsgBox(4096, "Default Browser", _GetDefBrowser())
; ===============================================================================================================================
Func _GetDefBrowser()
    Local Static $s_reg = RegRead("HKCR\http\shell\open\command", "")
    Return StringRegExpReplace($s_reg, "(.*?\x22)(.*?[\\/])*(.*?)(\x22.*?\z)", "$3")
EndFunc   ;==>_GetDefBrowser

Example:

MsgBox(4096, "Browser", "My browser is: " & _GetDefBrowser())

João Carlos

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites



I cant see the source, only the header


Drunken Frat-Boy Monkey Garbage

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I cant see the source, only the header

And I can not edit my own first post!!!

Now everything is ok!

João Carlos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Now even the post # 3!!! This interface is a absolute madness...

You see, I can edit the message, not the first and third!

Here is a link to the source code: http://autoitbrasil.com/index.php?/topic...wserau3-udf/page__view__findpo

João Carlos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Strange! Nice UDF on the (what appears to be) new Brazilian forum!

I also saw your version of _GetOSLangString.au3 which is a very different approach to how I did it >>


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@guinness

Thank you, and I didn't know you had also done (_GetOSLang*) quite a while that did not sign in here!

This interface is now a horrible, discouraged me, and now has the http://www.autoitbrasil.com - I posted a lot there, but when I saw this update...

Does your registration there too to provide a force to the people!

João Carlos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

It appears that the spoiler tags break the interface. For now, do not use them.

Edited by big_daddy
1 person likes this

Share this post


Link to post
Share on other sites

Great work João, I could not for the life of me track down a stable registry entry to poll for this information! A potential way to speed the function up while maintaining core functionality is to loose the "__PathSplitNew()" function and instead use regex, like this:

Func _GetDefBrowser()
$browser = StringRegExp(RegRead("HKCR\http\shell\open\command", ""), '(?i).(\:)(.*)exe', 2)
return $browser[0]
EndFunc

Share this post


Link to post
Share on other sites

Func _GetDefBrowser()
    Local Static $s_reg = RegRead("HKCR\http\shell\open\command", "")
    Return StringRegExpReplace($s_reg, "(.*?\x22)(.*?[\\/])*(.*?)(\x22.*?\z)", "$3")
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@SmOke_N,

Perfect, thanks!

But please, tells me how this code "(.*?\x22)(.*?[\\/])*(.*?)(\x22.*?\z)", "$3" only returns the name.extension?

I think I'll never understand how this function works!

João Carlos.

Edited by jscript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

(.*?\x22) - capture everything to and including the double quote

(.*?[\\/])* - capture everything to forward ( or backward ) slash ( * means to repeat until there is no more pattern like this to capture )

(.*?)(\x22.*?\z) - capture everything to the double quote, then capture the double quote and everything after to the end of the string.

The 3rd pattern group (.*?) is what we want, so we use "$3" in the 3rd param of StringRegExpReplace() function.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Some great tutorials on youtube!

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0