z0mgItsJohn Posted January 19, 2009 Share Posted January 19, 2009 Well I'm Trying To Make A Script That Has A GUI And The GUI Has Something Like Hyperlinks And When You Click One Of The "Hyperlinks" It Executes A Function.. How In The World Would I Go About Doing This xD.. Thanks In Advance! =3 - John Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
Tomb Posted January 19, 2009 Share Posted January 19, 2009 use GUICtrSetOnEvent a label is a GUI control so it will work. Link to comment Share on other sites More sharing options...
NerdFencer Posted January 19, 2009 Share Posted January 19, 2009 Here is an example of another method which could be adapted for sections in a control (such as a word in an edit box) if you want to, its a bit messy but it works. Replace the message box with whatever action you want. #include <Misc.au3> $GUI = GUICreate("Some GUI",200,50) ;variables for position of label for easy reading $LabelX = 5 $LabelY = 5 $LabelW = 56 $LabelH = 11 $Label = GUICtrlCreateLabel("Some Label",$LabelX,$LabelY,$LabelW,$LabelH) GUISetState() While GUIGetMsg()<>-3 Sleep(2) $Pos = GUIGetCursorInfo($GUI) If (_IsPressed("01") And $Pos[0]>=$LabelX And $Pos[0]<=$LabelX+$LabelW And $Pos[1]>=$LabelY And $Pos[1]<=$LabelY+$LabelH) Then MsgBox(0,"Click","You Clicked the Label!") EndIf WEnd _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
smashly Posted January 19, 2009 Share Posted January 19, 2009 (edited) Hi, expandcollapse popup#include <GUIConstantsEx.au3> Global $Label[4][2] = [["",""], ["", "autoitscript.com"], ["", "/forum/index.php?"], ["", "/autoit3/downloads.shtml"]] $hGui = GUICreate("Autoit Links") For $i = 1 To 3 Local $sAdress = "http://www." & $Label[1][1] If $i > 1 Then $sAdress = "http://www." & $Label[1][1] & $Label[$i][1] $Label[$i][0] = GUICtrlCreateLabel($sAdress, 5, ($i * 25) - 15, 360, 20) GUICtrlSetFont(-1, Default, Default, 4) Next GUISetState(@SW_SHOW, $hGui) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $Label[1][0] To $Label[3][0] ShellExecute(GUICtrlread($msg)) EndSwitch $GGCI = GUIGetCursorInfo($hGui) Switch $GGCI[4] Case $Label[1][0] To $Label[3][0] If $GGCI[4] <> $Label[0][0] Then GUICtrlSetColor($Label[0][0], 0x000000) GUICtrlSetFont($Label[0][0], Default, Default, 4) GUICtrlSetColor($GGCI[4], 0x0000FF) GUICtrlSetFont($GGCI[4], 11, 700, 6) $Label[0][0] = $GGCI[4] EndIf Case Else GUICtrlSetColor($Label[0][0], 0x000000) GUICtrlSetFont($Label[0][0], Default, Default, 4) $Label[0][0] = $GGCI[4] EndSwitch WEnd Cheers Edited January 19, 2009 by smashly Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted January 19, 2009 Author Share Posted January 19, 2009 Thank You!!! ^.^ Here's A Little Function I Made In Case Someone Else Might Wanna Use It.. ; Function : _LabelClickOnEvent Func _LabelClickOnEvent ($Control_ID, $Event, $Size = '9', $Weight = '400', $Attribute = '4', $Fontname = '', $Color = '0x0000FF', $Bk_Color = $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont ($Control_ID, $Size, $Weight, $Attribute, $Fontname) GUICtrlSetColor ($Control_ID, $Color) GUICtrlSetBkColor ($Control_ID, $Bk_Color) GUICtrlSetOnEvent ($Control_ID, $Event) EndFuncoÝ÷ ØÚ-y8^ çÚº[Oj¶¦z׫°Æ¤xK¢G*^®X§*.ÇÅ©©à.Ý«¢+Ø%¹±Õ±ÐíU% ½¹ÍѹÑ̹ÔÌÐì)=ÁÐ ÌäíU%=¹Ù¹Ñ5½Ìäì°ÌäìÄÌäì¤((ÀÌØíU$ôU% ÉÑ ÌäíQÍÐÌäì°ÌäìØÌÌäì°ÌäìÌÔÌäì°Ìäì´ÄÌäì°Ìäì´ÄÌäì°Ìäì´ÄÌäì°ÌäìÄÈàÌäì¤)U%MÑ=¹Ù¹Ð ÀÌØíU%}Y9Q} 1=M°Ìäí}á¥ÐÌäì¤(ÀÌØí1°ôU% Ñɱ ÉÑ1° Ìäí5Í ½àÌäì°ÌäìÄÀÌäì°ÌäìÄÀÌäì°ÌäìÐÌÌäì°ÌäìÄÐÌäì¤)}1± ±¥=¹Ù¹Ð ÀÌØí1°°Ìäí}5Í ½àÌäì¤)U%MÑMÑÑ¡M]}M!=¤()]¡¥± ÌäìÄÌäì¤)M±À ÌäìÄÔÀÌäì¤)]¹()Õ¹}5Í ½à ¤)5Í ½à ÌäìÀÌäì°ÌäíQÍÐÌäì°Ìäí1± ±¥=¹Ù¹ÐüÌäì°ÌäìÀÌäì¤)¹Õ¹()Õ¹}1± ±¥=¹Ù¹Ð ÀÌØí ½¹Ñɽ±}%°ÀÌØíٹаÀÌØíM¥éôÌäìäÌäì°ÀÌØí]¥¡ÐôÌäìÐÀÀÌäì°ÀÌØíÑÑÉ¥ÕÑôÌäìÐÌäì°ÀÌØí½¹Ñ¹µôÌäìÌäì°ÀÌØí ½±½ÈôÌäìÁàÀÀÀÁÌäì°ÀÌØí } ½±½ÈôÀÌØíU%} - =1=I}QI9MAI9P¤)U% ÑɱMѽ¹Ð ÀÌØí ½¹Ñɽ±}%°ÀÌØíM¥é°ÀÌØí]¥¡Ð°ÀÌØíÑÑÉ¥ÕÑ°ÀÌØí½¹Ñ¹µ¤)U% ÑɱMÑ ½±½È ÀÌØí ½¹Ñɽ±}%°ÀÌØí ½±½È¤)U% ÑɱMÑ ½±½È ÀÌØí ½¹Ñɽ±}%°ÀÌØí } ½±½È¤)U% ÑɱMÑ=¹Ù¹Ð ÀÌØí ½¹Ñɽ±}%°ÀÌØíٹФ)¹Õ¹()Õ¹}á¥Ð ¤)á¥Ð)¹Õ¹ - John Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
smashly Posted January 19, 2009 Share Posted January 19, 2009 (edited) Hi, here's another using on event with a modified version of your function. expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Global $Label[4][2] = [["",""], ["", "autoitscript.com"], ["", "/forum/index.php?"], ["", "/autoit3/downloads.shtml"]] $hGui = GUICreate("Autoit Links") GUISetOnEvent($GUI_EVENT_CLOSE, "Event") For $i = 1 To 3 Local $sAdress = "http://www." & $Label[1][1] If $i > 1 Then $sAdress = "http://www." & $Label[1][1] & $Label[$i][1] $Label[$i][0] = GUICtrlCreateLabel($sAdress, 5, ($i * 25) - 15, 360, 20) GUICtrlSetOnEvent(-1, "Event") _LabelSet($Label[$i][0], Default, 0x0000FF, Default, Default, 4) Next GUISetState(@SW_SHOW, $hGui) While 1 Sleep(100) $GGCI = GUIGetCursorInfo($hGui) Switch $GGCI[4] Case $Label[1][0] To $Label[3][0] If $GGCI[4] <> $Label[0][0] Then _LabelSet($Label[0][0], Default, 0x0000FF, Default, Default, 4) _LabelSet($GGCI[4], Default, 0x0000FF, 11, 700, 6) $Label[0][0] = $GGCI[4] EndIf Case Else _LabelSet($Label[0][0], Default, 0x0000FF, Default, Default, 4) $Label[0][0] = $GGCI[4] EndSwitch WEnd Func Event() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Label[1][0] To $Label[3][0] ShellExecute(GUICtrlread(@GUI_CtrlId)) EndSwitch EndFunc Func _LabelSet($cID, $iBkClr = Default, $iClr = Default, $iSz = Default, $iWt = Default, $iAttr = Default, $sFont = "") GUICtrlSetFont ($cID, $iSz, $iWt, $iAttr, $sFont) GUICtrlSetColor ($cID, $iClr) GUICtrlSetBkColor ($cID, $iBkClr) EndFunc Cheers Edit: Set the links to blue.. lol Edited January 19, 2009 by smashly Link to comment Share on other sites More sharing options...
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