Jump to content

Click link in a GUI


Sajesh
 Share

Recommended Posts

Welcome!

Example:

#include <GuiConstants.au3>

Global $Flag = 1

$hGui = GUICreate(":-)", 240, 120)

$URL_Label = GUICtrlCreateLabel("Welcome to AutoIT forum", 60, 40, 130, 16)
GUICtrlSetCursor(-1, 0)
;GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    Case $GUI_EVENT_MOUSEMOVE
        $aCurPos = GUIGetCursorInfo()
        
        If $aCurPos[4] = $URL_Label And $Flag = 1 Then
            GUICtrlSetColor($URL_Label, 0xFF0000)
            GUICtrlSetFont($URL_Label, Default, Default, 2)
            $Flag = 0
        ElseIf $aCurPos[4] <> $URL_Label And $Flag = 0 Then
            GUICtrlSetColor($URL_Label, 0x000000)
            GUICtrlSetFont($URL_Label, Default)
            $Flag = 1
        EndIf
    Case $URL_Label
        ShellExecute("http://www.autoitscript.com/forum")
    EndSwitch
WEnd
:)
Link to comment
Share on other sites

I need to click a link in GUI window.

Not really sure but I think he wanted to know how to click on a link, not create a GUI with a link.

@Sajesh...is it a IE window that has the link?...If so look in the helpfile for IE functions.

Link to comment
Share on other sites

Not really sure but I think he wanted to know how to click on a link, not create a GUI with a link.

@Sajesh...is it a IE window that has the link?...If so look in the helpfile for IE functions.

Sorry for not explaining my question well.

Actually I am testing a window that has a link.

My objective is to click that link in the GUI window without using mouse and I dont have the URL of that link.

How can I recognize that link in the window and click it with the keyboard.

Please explain.

Link to comment
Share on other sites

Welcome!

Example:

#include <GuiConstants.au3>

Global $Flag = 1

$hGui = GUICreate(":-)", 240, 120)

$URL_Label = GUICtrlCreateLabel("Welcome to AutoIT forum", 60, 40, 130, 16)
GUICtrlSetCursor(-1, 0)
;GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    Case $GUI_EVENT_MOUSEMOVE
        $aCurPos = GUIGetCursorInfo()
        
        If $aCurPos[4] = $URL_Label And $Flag = 1 Then
            GUICtrlSetColor($URL_Label, 0xFF0000)
            GUICtrlSetFont($URL_Label, Default, Default, 2)
            $Flag = 0
        ElseIf $aCurPos[4] <> $URL_Label And $Flag = 0 Then
            GUICtrlSetColor($URL_Label, 0x000000)
            GUICtrlSetFont($URL_Label, Default)
            $Flag = 1
        EndIf
    Case $URL_Label
        ShellExecute("http://www.autoitscript.com/forum")
    EndSwitch
WEnd
:)
Thanks Rasim! I gained a lot of knowledge from ur code.
Link to comment
Share on other sites

  • Moderators

But spy is not recognizing the link. Is there any other way?

Can we have the app name... maybe someone can show you easily rather than guessing what it would be.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 1 month later...

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...