Jump to content
Sign in to follow this  
Chimaera

Weblink on a GUI

Recommended Posts

Chimaera

Hi all

Im doing a small gui and i need to put 2 web address on it as links so when you click it takes you to the website

I did some searching and found a few bits from which i came up with this

$LinkLabel_1 = GUICtrlCreateLabel('www.google.co.uk', 50, 210, 250)
GUICtrlSetFont(-1, 12, 500, "", "Tahoma")

; and in my While-Wend statement
        Case $LinkLabel_1
   ShellExecute("www.google.co.uk")

But it doesn't look like a link if you know what i mean, like where it changes the cursor to a hand and the link is blue

Whats the easiest way to make it like any link that you would see on a webpage?

Share this post


Link to post
Share on other sites
guinness

Check out this UDF by Yashied. >>


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Chimaera

Ok with some messing about i managed to get that working but .

$Text = 'The SysLink controls provides a convenient way to embed hypertext links in a window. For more information, click <A HREF="http://msdn.microsoft.com/en-us/library/bb760706(VS.85).aspx">here</A>.' & @CRLF & @CRLF & _
        'To learn how to use the SysLink controls in AutoIt, click <A HREF="http://www.autoitscript.com/forum/">here</A>.'
$hForm = GUICreate("MyGUI", 428, 160)
$hStatusBar = _GUICtrlStatusBar_Create($hForm)
$hSysLink = _GUICtrlSysLink_Create($hForm, $Text, 10, 10, 408, 54)
$Dummy = GUICtrlCreateDummy()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()

The text in $Text i cannot change the font or the size of it which looks cack against the rest of the gui

I tried $Text and $hSysLink with GUICtrlSetFont(-1, 12, 500, "", "Tahoma")

But no joy

Care to take a stab at where to influence the text?

Share this post


Link to post
Share on other sites
Yashied

Share this post


Link to post
Share on other sites
Chimaera

Thx for that Yashied

But i have no idea what to do with that

Ive searched GuiSysLink.au3 & SysLink_Ex.au3 & SysLinkConstants.au3

but i cant see anything similar to that to overwrite

Could you be a little more specific plz

Share this post


Link to post
Share on other sites
guinness

Place that in between $hSysLink = _GUICtrlSysLink_Create and $Dummy = GUICtrlCreateDummy(). GUICtrlSetFont is only for controls created natively by AutoIt, which this isn't.

Edit: I forgot to mention you might need to include WinAPI.au3 if not already included.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Chimaera

Ok that gave a load of errors and ive reduced it to these

C:\Users\Jez\Desktop\tt.au3(86,72) : ERROR: $DEFAULT_CHARSET: undeclared global variable.
$hFont = _WinAPI_CreateFont(19, 0, 0, 0, 500, 0, 0, 0, $DEFAULT_CHARSET,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jez\Desktop\tt.au3(86,93) : ERROR: $OUT_DEFAULT_PRECIS: undeclared global variable.
$hFont = _WinAPI_CreateFont(19, 0, 0, 0, 500, 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jez\Desktop\tt.au3(86,115) : ERROR: $CLIP_DEFAULT_PRECIS: undeclared global variable.
$hFont = _WinAPI_CreateFont(19, 0, 0, 0, 500, 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Jez\Desktop\tt.au3(86,133) : ERROR: $DEFAULT_QUALITY: undeclared global variable.
$hFont = _WinAPI_CreateFont(19, 0, 0, 0, 500, 0, 0, 0, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

I added the include for WinApi

Do i just manually add all of these as globals ? or have i missed something

If i didnt know better id say its not finding the include

Share this post


Link to post
Share on other sites
Yashied
guinness

I didn't test it so forgot that FontConstants would be required too.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Chimaera

That's working now so thx for the help

To my level it seems a horribly complex way to add 2 weblinks but it works that's the main thing

Thx again

Share this post


Link to post
Share on other sites
GEOSoft

you probably could have just used the label code you had and set the text color to 0x0000ff as long as it was working anyway.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
BrewManNH

Yes i considered that but the change of the cursor enhances it so much more

I created this as a Credits box for a program I had written that does just that, it shows up as what appears to be links on the GUI, and the cursor changes as it goes over the label.

Opt("GUIOnEventMode", 1)
Demo()
Func Demo()
    Global $Func[4], $URL[4]
    $URL[0] = "http://www.autoitscript.com/forum/index.php?showtopic=83481"
    $URL[1] = "http://www.autoitscript.com/forum/index.php?showtopic=43950"
    $URL[2] = "http://www.autoitscript.com/forum/index.php?showtopic=120154&view=findpost&p=835800"
    $URL[3] = "http://www.autoitscript.com/forum/index.php?showtopic=109096"
    Local $Text = "This program could not have been successfully completed without the amazing people" & _
            " on the AutoItScript forums, even those that didn't know that they helped me. The program is mostly original " & _
            "code with a sprinkling of code that was found in various threads on the forums." & @LF & @LF & _
            "I have also used the following UDFs in the creation of this script and I would like to give credit where credit is due: "
    $Func[0] = "Bass.au3" & @TAB & @TAB & "by BrettF"
    $Func[1] = "ID3.au3" & @TAB & @TAB & "by joeyb1275"
    $Func[2] = "RecFileListToArray" & @TAB & "by Melba23"
    $Func[3] = "ExtMsgBox" & @TAB & @TAB & "by Melba23"
    $Temp = GUICreate("Credits", 800, 270, -1, -1)
    GUISetOnEvent(-3, "DemoClose")
    GUISetBkColor(0x0FFFFFF, $Temp)
    GUICtrlCreateLabel($Text, 40, 10, 750, 100)
    GUICtrlSetFont(-1, 10, 800, -1, "Consolas")
    GUICtrlSetColor(-1, 0x0000000)
    Global $close = GUICtrlCreateButton(" Close ", 360, 230, -1)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    For $I = 0 To 3
        GUICtrlCreateLabel($Func[$I], 40, 130 + ($I * 20), 200, 20)
        GUICtrlSetColor(-1, 0x000000)
        GUICtrlSetFont(-1, 9, 400, 0)
    Next
    Global $Label1 = GUICtrlCreateLabel($URL[0], 260, 130, 400, 20)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    Global $Label2 = GUICtrlCreateLabel($URL[1], 260, 150, 400, 20)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    Global $Label3 = GUICtrlCreateLabel($URL[2], 260, 170, 348, 20)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    Global $Label4 = GUICtrlCreateLabel($URL[3], 260, 190, 400, 20)
    GUICtrlSetOnEvent(-1, "_EMBURL")
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetColor(-1, 0x00000FF)
    GUICtrlSetFont(-1, 9, 400, 4)
    GUISetState()
EndFunc   ;==>Demo
While 1
    Sleep(10)
WEnd
Func _EMBURL()
    Switch @GUI_CtrlId
        Case $Label1
            ShellExecute($URL[3])
        Case $Label2
            ShellExecute($URL[3])
        Case $Label3
            ShellExecute($URL[3])
        Case $Label4
            ShellExecute($URL[3])
        Case $close
            Exit
    EndSwitch
EndFunc   ;==>_EMBURL
Func DemoClose()
    Exit
EndFunc   ;==>DemoClose

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Newb

maybe it's late but why not put a button or a label with text in it (paint it blue and underline it if you want to give it a link-like look) that when clicked opens the site, that wouldn't require any udf i guess


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites
BrewManNH

Newb, look up one post from your's.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Newb

Sorry, didn't read. Just plain replied what I thought could be a simple solution i would have applied.

The fact geosoft thought of it too makes me proud, YUIK!


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
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
Sign in to follow this  

×