Jump to content
SerLanceloth

Button to default browser

Recommended Posts

SerLanceloth

hello guys, im looking for a way to open a new tab on the default browser to a certain URL 

for example, all lets say a button that opens youtube or any other webpage when you click on it

thank you all for your assist

Share this post


Link to post
Share on other sites
AutoBert

Just like this:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example", 300, 200)

    ; Create a button control.
    Local $idYT = GUICtrlCreateButton("Run Youtube", 120, 170, 85, 25)
    Local $idClose = GUICtrlCreateButton("Close", 210, 170, 85, 25)

    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    Local $iPID = 0

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idClose
                ExitLoop

            Case $idYT
                $iPID=ShellExecute('https://www.youtube.com/')
        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)

    ; Close the Webbrowser process using the PID returned by ShellExecute.
    If $iPID Then ProcessClose($iPID)
EndFunc   ;==>Example

 

Edited by AutoBert

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

×