quick_sliver007 Posted April 6, 2005 Share Posted April 6, 2005 How do I put a internet link in my GUI? . Link to comment Share on other sites More sharing options...
GaryFrost Posted April 6, 2005 Share Posted April 6, 2005 here's an example of an email link, your link can be anything you want. expandcollapse popup#include <GUIConstants.au3> #include <Inet.au3> GUICreate("Create a link", 500, 250) #Region --- CFCCodeWizard generated code Start --- Dim $CADET_BLUE_3 = 0x7AC5CD GUISetBkColor($CADET_BLUE_3) #EndRegion --- CFCCodeWizard generated code End --- $LABEL = _GuiCtrlCreateHyperlink("Email me if you can", 27, 130, 443, 20, 0x0000ff, 'E-Mail ' & "your email.com" & " (comments/questions)") $CLOSE = GUICtrlCreateButton("Close", 200, 190, 85, 20) GUISetState() Do $MSG = GUIGetMsg() Select Case $MSG = $CLOSE ExitLoop Case $MSG = $LABEL _INetMail("your email.com", "Regarding " & "some subject", "") 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 ;==>_GuiCtrlCreateHyperlink 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 More sharing options...
quick_sliver007 Posted April 6, 2005 Author Share Posted April 6, 2005 Thank you, but how do I make it go to a url instead of the mail client. Like a web page. . Link to comment Share on other sites More sharing options...
kjactive Posted April 6, 2005 Share Posted April 6, 2005 (edited) You could just let windows Explorer handle the address like this Run('C:\Programmer\Internet Explorer\IExplore.exe "http://tv2.dk"', '', @SW_MAXIMIZE) or use CWepPage.dll tp browse the links like anyother browser from a html code... Kåre Edited April 6, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
quick_sliver007 Posted April 6, 2005 Author Share Posted April 6, 2005 You could just let windows Explorer handle the address like thisRun('C:\Programmer\Internet Explorer\IExplore.exe "http://tv2.dk"' '', @SW_MAXIMIZE)or use CWepPage.dll tp browse the links like anyother browser from a html code...Kåre<{POST_SNAPBACK}>Thank you . Link to comment Share on other sites More sharing options...
Ejoc Posted April 6, 2005 Share Posted April 6, 2005 (edited) I posted this in another topic, this uses the default web browser: #include <file.au3> $URL = "http://www.autoitscript.com/forum" $fd = FileOpen(@TEMPDir & "url.url",2) if $fd = -1 Then Exit FileWriteLine($fd,"[InternetShortcut]") FileWriteLine($fd,"URL=" & $URL) FileClose($fd) Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34)) *EDIT You should use people's default browsers not hardcode it to IE, as I'm sure other people like my self wont use applications that open IE since its a security hole. Edited April 6, 2005 by Ejoc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
quick_sliver007 Posted April 6, 2005 Author Share Posted April 6, 2005 I posted this in another topic, this uses the default web browser:#include <file.au3> $URL = "http://www.autoitscript.com/forum" $fd = FileOpen(@TEMPDir & "url.url",2) if $fd = -1 Then Exit FileWriteLine($fd,"[InternetShortcut]") FileWriteLine($fd,"URL=" & $URL) FileClose($fd) Run(@comspec & " /c " & chr(34) & @TEMPDir & "url.url" & chr(34))*EDITYou should use people's default browsers not hardcode it to IE, as I'm sure other people like my self wont use applications that open IE since its a security hole.<{POST_SNAPBACK}>Thank you so much. These is what I been looking for. . Link to comment Share on other sites More sharing options...
nhalme Posted October 20, 2008 Share Posted October 20, 2008 Hi, I did not like the command prompt window (@comspec & " /c " ....etc.) even it shows up only for half second or so . The kjactive's approach is what I like so here is my version of it: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1); Change to OnEvent mode GUICreate("My Link GUI", 200, 100) GUISetBkColor(0xFFFFFF); will change background color GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE") $LinkLabel = GUICtrlCreateLabel("www.google.com", 10, 10,100) GUICtrlSetColor(-1, 0x0000ff) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetOnEvent($LinkLabel, "Link") GUISetState(@SW_SHOW); will display the dialog box While 1 Sleep(1000); Idle around WEnd Func Link() $IEPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE", "") Run($IEPath & " http://www.google.com") Exit EndFunc ;==>Link Func CLOSE() Exit EndFunc -nhalme- Link to comment Share on other sites More sharing options...
KabirSoftInc Posted October 20, 2008 Share Posted October 20, 2008 (edited) @ nhalmeYou dumped a very old thread just to show your code?this thread was started at Apr-5-2005, 10:15 PMand i think the topic starter have resolved his problem as he said in his previous post.Thank you so much. These is what I been looking for.6) Edited October 20, 2008 by KabirSoftInc Link to comment Share on other sites More sharing options...
MrCreatoR Posted October 20, 2008 Share Posted October 20, 2008 I did not like the command prompt window (@comspec & " /c " ....etc.) even it shows up only for half second or soYou can hide it (@SW_HIDE).Run($IEPath & " http://www.google.com")And what if i disabled the IE in my system? Imo, ShellExecute($sURL) is the best solution here (will open default browser). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
nhalme Posted October 20, 2008 Share Posted October 20, 2008 I apologize, KabirSoftInc, for opening this thread, but I at least got some new tips from it You dumped a very old thread just to show your code? Not to show my code, only share so perhaps someone newbie like me could have some other options as well. Would it be better to make a new thread? I'm new on this threading stuffYou can hide it (@SW_HIDE). That is true and it works perfectly! So my code and comments can be thrown away And what if i disabled the IE in my system? Imo, ShellExecute($sURL) is the best solution here (will open default browser). I like this style. This is totally the best solution!Thank you so much, MrCreatoR, for the good tips. In a way Im glad that I reopened the thread 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