Jump to content

E-Mail / URL HyperLink


Helvio
 Share

Recommended Posts

First of All, I'm brand new in this forum, but now so new on AutoIt Script :king:

I'm not home atm, using a dial-up pay-per-use connection :">

I tryed searching a bit for the things I wanna do but haven't found anything... And I can't be on for long, so can't really perform a real search... I apologize for this, hope u guys (n girls) understand... ;)

(BTW I just LOVED those emoticons :lmao: )

The thing is... I've been looking for a way to put those blue-underlined hyperlinks to websites and e-mails inside MsgBoxes maybe, or even inside the GUI...

Is there any way??

Thank you guys... Soon I'll submit some scripts I made and update my profile o:)

Hugglets!

Current Scripts:ShutTimer ;Shuts down the PC in countdown (HH:MM) or in a certain timeAsk me for em if u want :P

Link to comment
Share on other sites

Bump and...

If this was asked before... Just tell me "There is no way, give up"...

My time is running out =X

Hugs

Current Scripts:ShutTimer ;Shuts down the PC in countdown (HH:MM) or in a certain timeAsk me for em if u want :P

Link to comment
Share on other sites

  • Moderators

Oh sure, post the perfect link!

:lmao: , Only because I use this in about 90% of my scripts ;)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I just had an idea on how to insert a hyperlink INSIDE a MsgBox!

Well... a Pseudo-MsgBox ;)

Maybe you can use the above method (in the link) and simulate a MsgBox with a GUI!

Maybe one of u pro guys can make it to show us... so we'd see how it would look like :lmao:

Hugs!

Current Scripts:ShutTimer ;Shuts down the PC in countdown (HH:MM) or in a certain timeAsk me for em if u want :P

Link to comment
Share on other sites

  • Moderators

Here Try this:

#include <Inet.au3>
Global $MAILTO = 'YourEmailAddress@SomWhere.Com'
Dim $MyMsgBox = _MsgBox(2, 'Email Us', 'Click the Link Below or Click "OK" to email us!')
If $MyMsgBox = 6 Then
    _INetMail($MAILTO, 'Regarding: ', '')
Else
    Exit
EndIf

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 5
    Local $Button1Txt = "Ok"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    $iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    $Label = GUICtrlCreateLabel($mb_Text, 60, 10)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $OK = GUICtrlCreateButton($Button1Txt, 30 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $CANCEL = GUICtrlCreateButton($Button2Txt, 100 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
    $ControlPos = ControlGetPos($iMsgBox, $mb_Text, $OK)
    $EMAIL = _GuiCtrlCreateHyperlink("Email Us: Click to Email", $ControlPos[0], $ControlPos[1] - 15, 150, 25, 0x0000FF, 'E-Mail ' & _
         "SomeAddress@SomeWhere.com" & " (Comments/Questions)")
         
    GUISetState()
    If $mb_Time <> '' Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
        Case $imsg = $OK
                $MsgValue = 6
                ExitLoop
            Case $imsg = $CANCEL
                $MsgValue = 7
                ExitLoop
            Case $imsg = $EMAIL
                _INetMail($MAILTO, 'Regarding: ', '')
            Case $mb_Time <> ''
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func MsgLongestString($sText)
    Local $sSplit = StringSplit($sText, @CRLF)
    Local $Times = ''
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
        If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
        Return Round(StringLen($sSplit[1])*$Times)
    Else
        If StringLen($sText) <= 100 Then $Times = 2.25
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
        If StringLen($sText) >= 202 Then $Times = 3.25
        Return Round(StringLen($sText)*$Times)
    EndIf
EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc

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, 1)
        GUICtrlSetColor($I_CTRLID, $I_COLOR)
        GUICtrlSetCursor($I_CTRLID, 0)
        If $S_TOOLTIP <> '' Then
            GUICtrlSetTip($I_CTRLID, $S_TOOLTIP)
        EndIf
    EndIf
    Return $I_CTRLID
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Your welcome, but Thank Gary... (gafrost) for the Hyperlink UDF!! Good luck and welcome to the Forums.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...