Sign in to follow this  
Followers 0
VinzParamore

Help: Launching a Browser

6 posts in this topic

Hello guyz...

I am new here! :D

Does anybody know how to Launch your default Browser? :D

Like Mozilla or Chrome or Opera ETC.?...

I don't like IE...

my default Browser is Mozilla..

any Help?? :D

Good Help will be appreciated...

Share this post


Link to post
Share on other sites



This should give you the default Browser

ConsoleWrite(RegRead("HKCR\HTTP\shell\open\command\", ""))

Use ShellExecute to start the Browser.

See this post.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$Command = RegRead('HKCR\' & RegRead('HKCR\.html', '') & '\shell\open\command', '')
If StringLeft($Command, 1) = '"' Then
    $Path = StringRegExpReplace($Command, '\A"+|".*\z', '')
Else
    $Path = StringRegExpReplace($Command, '\A\s+|\s.*\z', '')
EndIf
ConsoleWrite($Path & @CR)
ShellExecute($Path)

Pattern for StringRegExpReplace() is written by MrCreatoR.

Edited by Yashied

Share this post


Link to post
Share on other sites

Another way.

Global Const $ASSOCSTR_EXECUTABLE = 2

$Path = _WinAPI_AssocQueryString('.html', $ASSOCSTR_EXECUTABLE)
ShellExecute($Path)

Func _WinAPI_AssocQueryString($sAssoc, $iType, $iFlags = 0, $sExtra = '')

    Local $TypeOfExtra = 'wstr'

    If StringStripWS($sExtra, 3) = '' Then
        $TypeOfExtra = 'ptr'
        $sExtra = 0
    EndIf

    Local $Ret

    $Ret = DllCall('shlwapi.dll', 'int', 'AssocQueryStringW', 'dword', $iFlags, 'dword', $iType, 'wstr', $sAssoc, $TypeOfExtra, $sExtra, 'ptr', 0, 'dword*', 0)
    If (@error) Or (Not ($Ret[0] = 1)) Then
        Return SetError(1, 0, '')
    EndIf

    Local $tData = DllStructCreate('wchar[' & $Ret[6] & ']')

    $Ret = DllCall('shlwapi.dll', 'int', 'AssocQueryStringW', 'dword', $iFlags, 'dword', $iType, 'wstr', $sAssoc, $TypeOfExtra, $sExtra, 'ptr', DllStructGetPtr($tData), 'dword*', $Ret[6])
    If (@error) Or (Not ($Ret[0] = 0)) Then
        Return SetError(1, 0, '')
    EndIf
    Return DllStructGetData($tData, 1)
EndFunc   ;==>_WinAPI_AssocQueryString

Share this post


Link to post
Share on other sites

A Lot of Thank you guys....

This Post is Solved :D

I love this Forum!

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