Jump to content

Create a link and run something


 Share

Recommended Posts

hello,

is it what do you need ?

#include <GUIConstants.au3>



GuiCreate("MyGUI", 390, 316,(@DesktopWidth-390)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Label_1 = GuiCtrlCreateLabel("click me to run", 50, 80, 190, 20)
GUICtrlSetColor ( -1, 0x0000ff)
GUICtrlSetFont (-1, -1 , 800 , 6 )
GUICtrlSetCursor ( -1, 0 )
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg= $Label_1
        run("your_exe.exe")
    Case Else
    ;;;
    EndSelect
WEnd
Exit
Link to comment
Share on other sites

type this part of the code below the label

GUICtrlSetColor ( -1, 0x0000ff)
GUICtrlSetFont (-1, -1 , 800 , 6 )
GUICtrlSetCursor ( -1, 0 )

then add an action to the message loop

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Link..", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

GuiCtrlCreateLabel("NOT A LINK", 30, 110, 60, 20)
$link = GuiCtrlCreateLabel("LINK", 100, 110, 30, 20)
GuiCtrlCreateLabel("NOTALINK", 140, 110, 60, 20)
GUICtrlSetColor($link, 0x0000FF)
GUICtrlSetCursor($link, 0)
GUICtrlSetTip($link, "A msgbox")

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

FootbaG
Link to comment
Share on other sites

Example below for e-mail, can be any kind of hyperlink.

#include <GUIConstants.au3>
#include <Inet.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("Link..", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

   $LABEL = _GuiCtrlCreateHyperlink("Email me", 27, 130, 443, 20, 0x0000ff, 'E-Mail ' & "yourmail.com" & " (comments/questions)")
   $CLOSE = GUICtrlCreateButton("Close", 200, 190, 85, 20)
   GUISetState()
   Do
      $MSG = GUIGetMsg()
      Select
         Case $MSG = $CLOSE
            ExitLoop
         Case $MSG = $LABEL
            _INetMail($MAILTO, "Regarding " & $TITLE, "")
      EndSelect
   Until $MSG = $GUI_EVENT_CLOSE

;===============================================================================
;
; Function Name:    _GuiCtrlCreateHyperlink()
; Description:      Creates a label that acts as a hyperlink
;                   
; Parameter(s):     $s_Text       - Label text
;                   $i_Left          - Label left coord
;                   [$i_Top]      - Label top coord
;                    [$i_Width]      - Label width
;                   [$i_Height]      - Label height
;                    [$i_Color]      - Text Color
;                    [$s_ToolTip]  - Hyperlink ToolTip
;                    [$i_Style]      - Label style
;                    [$i_ExStyle]  - Label extended style
;
; Requirement(s):   None
; Return Value(s):  Control ID
;                   
; Author(s):        Saunders <krawlie@hotmail.com>
;
;===============================================================================

Func _GuiCtrlCreateHyperlink($s_Text, $i_Left, $i_Top, $i_Width = -1, $i_Height = -1, $i_Color = 0x0000ff, $s_ToolTip = '', $i_Style = -1, $i_ExStyle = -1)
    Local $i_CtrlID
    $i_CtrlID = GuiCtrlCreateLabel($s_Text, $i_Left, $i_Top, $i_Width, $i_Height, $i_Style, $i_ExStyle)
    If $i_CtrlID <> 0 Then
        GuiCtrlSetFont($i_CtrlID, -1, -1, 4)
        GuiCtrlSetColor($i_CtrlID, $i_Color)
        GuiCtrlSetCursor($i_CtrlID, 0)
        If $s_ToolTip <> '' Then
            GuiCtrlSetTip($i_CtrlID, $s_ToolTip)
        EndIf
    EndIf
    
    Return $i_CtrlID
EndFunc
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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