Jump to content
Sign in to follow this  
Weavertje

Insert link into a button

Recommended Posts

Hi @Weavertje, and welcome to the AutoIt forum :)
Sure we can!
To run a webpage, you could simply use _IECreate() function.

Global $objIE = _IECreate("www.google.com")

And you're done :)
You can then manage all the stuffs related to a webpage ( clicks, user forms, DOM objects ), with all the others _IE* functions.
Here you are your code slightly modified:

Spoiler
#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.0.0
    Author: Weaver
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>
#include <IE.au3>

$frmHelloWorld = GUICreate("Still Learning", 280, 280)

GUICtrlCreateLabel("Name", 8, 10)
$Name1 = GUICtrlCreateInput("Put Name Here", 50, 8, 120)
GUICtrlCreateLabel("Age", 8, 44)
$time1 = GUICtrlCreateInput("Put Age Here", 50, 40, 120)
GUICtrlCreateLabel("Country", 8, 78)
$time1 = GUICtrlCreateInput("Put Country Here", 50, 73, 120)
GUICtrlCreateLabel("....", 8, 112)
$time1 = GUICtrlCreateInput("Nothing Yet", 50, 108, 120)
GUICtrlCreateLabel("Sex", 8, 146)
$male1 = GUICtrlCreateCheckbox("Male", 50, 140, 120)

$female1 = GUICtrlCreateCheckbox ("Female", 50, 160, 120)

$sendbutton = GUICtrlCreateButton("Send", 8, 200, 60)

$stopbutton = GUICtrlCreateButton("Stop", 78, 200, 60)

$resetbutton = GUICtrlCreateButton("Reset", 148, 200, 60)

GUISetState(@SW_SHOW)

; This variable is used to see which messages the GUI send to the application
; ( click on a button, click on the Exit button, and so on... )
Global $intGUIMsg = 0

; Internet Explorer variable
Global $objIE



While 1
    $intGUIMsg = GUIGetMsg()

    Switch $intGUIMsg

        Case $sendbutton
            $objIE = _IECreate("www.google.com", 0, 1, 1, 1)
            If @error Then
                ConsoleWrite("Error while creating IE object. Error: " & @error & @CRLF)
            EndIf

        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    Sleep(10)
WEnd

By the way, I suggest you to use Koda to build your GUIs.
It's easier and faster.

Hope that helps :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

So i see its opening in internet explorer now.

i tried to open its with chrome. i know the line ShellExecute ("chrome.exe") is opening chrome.

But how do i link that to a button ?

 

Share this post


Link to post
Share on other sites

@Weavertje

Case $sendbutton             
    ShellExecute("chrome.exe www.google.com")

Play with it before ask :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

I rather use GUICtrlSetOnEvent


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...