Tagor Posted March 25, 2005 Posted March 25, 2005 Hi, I have searched in the manual, but I couldn't find this: I would like to create a link and onces it is clicked, it should run a certain code. Is this possible with autoit? Thanks!
sylvanie Posted March 25, 2005 Posted March 25, 2005 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
Tagor Posted March 26, 2005 Author Posted March 26, 2005 Thank, that is what I was searching for. Is there also a way to include this is an already existing label?
zcoacoaz Posted March 26, 2005 Posted March 26, 2005 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]
Tagor Posted March 26, 2005 Author Posted March 26, 2005 I am not sure. But doesn't the above code change the color and font of the text? I would like to have something like this: text text text HYPERLINK text text text text text.
layer Posted April 2, 2005 Posted April 2, 2005 ; 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
GaryFrost Posted April 2, 2005 Posted April 2, 2005 (edited) Example below for e-mail, can be any kind of hyperlink. expandcollapse popup#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 April 2, 2005 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now