Sign in to follow this  
Followers 0
quick_sliver007

How do I put a web link in my GUI

11 posts in this topic

How do I put a internet link in my GUI?


.

Share this post


Link to post
Share on other sites



here's an example of an email link, your link can be anything you want.

#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.

 

Share this post


Link to post
Share on other sites

Thank you, but how do I make it go to a url instead of the mail client. Like a web page.


.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by kjactive

Share this post


Link to post
Share on other sites

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

<{POST_SNAPBACK}>

Thank you

.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

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.

<{POST_SNAPBACK}>

Thank you so much. These is what I been looking for.

.

Share this post


Link to post
Share on other sites

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-

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@ nhalme

You dumped a very old thread just to show your code?

this thread was started at Apr-5-2005, 10:15 PM

and i think the topic starter have resolved his problem :P

as he said in his previous post.

Thank you so much. These is what I been looking for.

6)

Edited by KabirSoftInc

Share this post


Link to post
Share on other sites

I did not like the command prompt window (@comspec & " /c " ....etc.) even it shows up only for half second or so

You can hide it (@SW_HIDE).

Run($IEPath & " http://www.google.com")

And what if i disabled the IE in my system? :P

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_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

I apologize, KabirSoftInc, for opening this thread, but I at least got some new tips from it :P

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 stuff

You 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 :idea:

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  
Followers 0