Sign in to follow this  
Followers 0
Kjodiz

Input box to internet

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thanks, but it says it's missing a matching "Wend", and I can't seem to place it :/

Share this post


Link to post
Share on other sites

Seems you didn't copy the entire code. Last line is "WEnd" that missing for you.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Well this was embarrasing... :huh2:

Thanks for your help! =D

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