themax90 Posted February 12, 2005 Posted February 12, 2005 How do I create a link in a label so that it looks like a link on the web.Blue, underlined and if you click on it then he will goto a site with the default web client.Link in LabelCan you help?
themax90 Posted February 12, 2005 Author Posted February 12, 2005 Figured it out, sorry for the post. Func OpenSite($SitePath) If @OSTYPE = 'WIN32_NT' Then $Str = @ComSpec & ' /c start "" ' Else $Str = @ComSpec & ' /c start ' EndIf SplashTextOn( "Opening", "Website " & $SitePath & " opening.", 400, 25) Run($Str & $SitePath, '', @SW_HIDE) Sleep(1500) SplashOff() EndFunc ;==>OpenSite
themax90 Posted February 12, 2005 Author Posted February 12, 2005 No problem man, I actually picked it apart from the AutoIt Updater
layer Posted February 12, 2005 Posted February 12, 2005 ohh yea, i was looking for it in there too! when it first came out, but i was too lazy to go threw all that code FootbaG
themax90 Posted February 12, 2005 Author Posted February 12, 2005 I just used SciTe to Mark All http://'s and found _Start("http:.....") function. I marked the _Start function and figured it out, !!! Have fun!
therks Posted February 12, 2005 Posted February 12, 2005 Woot, glad to see people are getting some use out of my script. My AutoIt Stuff | My Github
themax90 Posted February 12, 2005 Author Posted February 12, 2005 Yah, thanks Saunders, can you figure out my Checkbox issuethough?
layer Posted February 12, 2005 Posted February 12, 2005 but how do you make the link...? i guess u could use GUICtrlSetMouse or w/e it is Cursor... and make it blue and underlined... ? and GUICtrlSetTip but is there an easier way to make a link... i guess just to put it all in one function.. whatvere, im just thinking, dont mind me FootbaG
themax90 Posted February 12, 2005 Author Posted February 12, 2005 Heres an example they could maybe put in the help file: #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $gui = GUICreate("Example", 197, 109, (@DesktopWidth - 197) / 2, (@DesktopHeight - 109) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Label_1 = GUICtrlCreateLabel("Clicking on the below text will open a website, hovering over it will create a tip.", 10, 10, 180, 50) $Label_2 = GUICtrlCreateLabel("Visit Google.", 10, 80, 180, 20) GUICtrlSetColor($Label_2, 0x0000ff) GUICtrlSetFont($Label_2, 9, 400, 4) GUICtrlSetTip($Label_2, "http://www.google.com/") GUISetState() While 1 $msg = GUIGetMsg(1) $msg_event = $msg[0] $msg_win = $msg[1] If $msg_event = $GUI_EVENT_CLOSE And $msg_win = $gui Then Exit EndIf If $msg_event = $Label_2 And $msg_win = $gui Then OpenSite("http://www.google.com") EndIf Wend Exit Func OpenSite($SitePath) If @OSTYPE = 'WIN32_NT' Then $Str = @ComSpec & ' /c start "" ' Else $Str = @ComSpec & ' /c start ' EndIf SplashTextOn( "Opening", "Website " & $SitePath & " opening.", 400, 25) Run($Str & $SitePath, '', @SW_HIDE) Sleep(1500) SplashOff() EndFunc ;==>OpenSite Have fun!
therks Posted February 12, 2005 Posted February 12, 2005 (edited) I tried. *Edit: This was responding to Smith's request to help with checkboxes... I didn't refresh the page before posting. Edited February 12, 2005 by Saunders My AutoIt Stuff | My Github
therks Posted February 12, 2005 Posted February 12, 2005 but how do you make the link...? i guess u could use GUICtrlSetMouse or w/e it is Cursor... and make it blue and underlined... ? and GUICtrlSetTip but is there an easier way to make a link... i guess just to put it all in one function.. whatvere, im just thinking, dont mind me <{POST_SNAPBACK}>A function eh?Hmm... would a UDF do?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) $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, 400, 4) GuiCtrlSetColor($i_CtrlID, $i_Color) GuiCtrlSetCursor($i_CtrlID, 0) If $s_ToolTip <> '' Then GuiCtrlSetTip($i_CtrlID, $s_ToolTip) EndIf EndIf Return $i_CtrlID EndFuncWorking Example:#include <GUIConstants.au3> $gui_Main = GUICreate("Hyperlink Test", 350, 212) $hl_AutoIt = _GuiCtrlCreateHyperlink('Visit AutoIt Homepage!', 5, 5, 200, 20, 0x0000ff, 'AutoItScript.com') $hl_Layer = _GuiCtrlCreateHyperlink('Visit Layer''s Homepage!', 5, 30, 200, 20, 0xff0000, 'Geocities.com/grxskate/', $SS_SUNKEN) GuiSetState() Do $msg = GuiGetMsg() If $msg = $hl_AutoIt Then MsgBox(8192,0,'http://www.autoitscript.com/') ElseIf $msg = $hl_Layer Then MsgBox(8192,0,'http://www.geocities.com/grxskate/') EndIf Until $msg = $GUI_EVENT_CLOSEPersonally, I'd never use it, but I guess it would seem simpler for some people. My AutoIt Stuff | My Github
themax90 Posted February 12, 2005 Author Posted February 12, 2005 Wow thats so much more complicated then my way. You are such an amazing complicated person!!! Lol J/k!
therks Posted February 12, 2005 Posted February 12, 2005 Wow thats so much more complicated then my way. You are such an amazing complicated person!!! LolJ/k!<{POST_SNAPBACK}>Heh, like I said, I'd never use the function, I'd do all the GuiCtrlSet... stuff myself. But for people who just want a quick fix, they could include that function and make a "hyperlink" as quickly/easily as a label. My AutoIt Stuff | My Github
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