Jump to content

Input box to internet


Recommended Posts

I'm trying to create an InputBox which you can write a website (URL?) in it.

When the OK button is pressed, a browser should pop up and you'll get into the site you want.

I really haven't done much with this, but as I know little about scripting and this is to learn, I'm stuck!

Help?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=F:\Scripts\AutoIt\Koda\Form1.kxf
$Form1 = GUICreate("Teh Internets", 615, 438, 192, 124)
$Input1 = GUICtrlCreateInput("", 208, 120, 97, 21)
$Button1 = GUICtrlCreateButton("OK", 176, 184, 75, 25)
$Button2 = GUICtrlCreateButton("Cancel", 264, 184, 75, 25)
$Label1 = GUICtrlCreateLabel("What website would you like to go to?", 184, 80, 184, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Input1
        Case $Button1
            
            
        Case $Button2
            ProcessClose ("AutoIt3.exe")
    EndSwitch
WEnd
Link to comment
Share on other sites

Something like this?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=F:\Scripts\AutoIt\Koda\Form1.kxf
$Form1 = GUICreate("Teh Internets", 615, 438, 192, 124)
$Input1 = GUICtrlCreateInput("www.google.com", 208, 120, 200, 21)
$Button1 = GUICtrlCreateButton("OK", 176, 184, 75, 25)
$Button2 = GUICtrlCreateButton("Cancel", 264, 184, 75, 25)
$Label1 = GUICtrlCreateLabel("What website would you like to go to?", 184, 80, 184, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $URL = GUICtrlRead($Input1)
            If $URL <> "" Then ShellExecute($URL) ;Open in default browser
        Case $Button2
            Exit
    EndSwitch
WEnd
Edited by Andreik

When the words fail... music speaks.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...