JScript Posted September 2, 2011 Share Posted September 2, 2011 (edited) Hello everyone!I made this UDF to get the name of the default browser!Updated: SmOke_N in StringRegExp()_GetDefBrowser.au3 - Source:expandcollapse popup#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 ;==>_GetDefBrowserExample:MsgBox(4096, "Browser", "My browser is: " & _GetDefBrowser())João Carlos Edited September 15, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
engjcowi Posted September 4, 2011 Share Posted September 4, 2011 I cant see the source, only the header Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
JScript Posted September 5, 2011 Author Share Posted September 5, 2011 (edited) I cant see the source, only the headerAnd I can not edit my own first post!!!Now everything is ok! João Carlos. Edited September 6, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
JScript Posted September 5, 2011 Author Share Posted September 5, 2011 (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 September 6, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
guinness Posted September 5, 2011 Share Posted September 5, 2011 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 >> UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
JScript Posted September 6, 2011 Author Share Posted September 6, 2011 (edited) @guinnessThank 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 September 6, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 6, 2011 Moderators Share Posted September 6, 2011 (edited) It appears that the spoiler tags break the interface. For now, do not use them. Edited September 6, 2011 by big_daddy JScript 1 Link to comment Share on other sites More sharing options...
JScript Posted September 6, 2011 Author Share Posted September 6, 2011 It appears that the spoiler tags break the interface. For now, do not use them.Great, now everything is ok! Thanks... João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Sunaj Posted September 15, 2011 Share Posted September 15, 2011 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 [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
JScript Posted September 15, 2011 Author Share Posted September 15, 2011 @Sunaj Thank you, I'll still learn/understand how to use this function! But it is returning the entire path, how to return only "name.exe" João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 15, 2011 Moderators Share Posted September 15, 2011 Func _GetDefBrowser() Local Static $s_reg = RegRead("HKCR\http\shell\open\command", "") Return StringRegExpReplace($s_reg, "(.*?\x22)(.*?[\\/])*(.*?)(\x22.*?\z)", "$3") EndFunc 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. Link to comment Share on other sites More sharing options...
JScript Posted September 15, 2011 Author Share Posted September 15, 2011 (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 September 15, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 15, 2011 Moderators Share Posted September 15, 2011 (.*?\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. 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. Link to comment Share on other sites More sharing options...
JScript Posted September 15, 2011 Author Share Posted September 15, 2011 @SmOke_N, Thank you very much! I need to learn much about it... João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
guinness Posted September 15, 2011 Share Posted September 15, 2011 (edited) Some great tutorials on youtube! Edited September 15, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
JScript Posted September 15, 2011 Author Share Posted September 15, 2011 (edited) Some great tutorials on youtube!Thanks!João Carlos. Edited September 15, 2011 by jscript http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! 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