Jump to content

Inserting a hpyerlink into a message box string.


Recommended Posts

Hey guys,

I'd like to be able to throw a MsgBox when an error comes up and give the user an easy to click on link to send me an e-mail if they feel they need any extra support.

Very simply speaking, I'd be looking to do something like

MsgBox(0,"Error","You've encountered error " & $err & ". Please click <a href="mailto:me@blah.com?subject='Error code" & $err &'>here</a> to e-mail me about it")

Is this at all possible?

Ta,

AC.

Link to comment
Share on other sites

Hey guys,

I'd like to be able to throw a MsgBox when an error comes up and give the user an easy to click on link to send me an e-mail if they feel they need any extra support.

Very simply speaking, I'd be looking to do something like

MsgBox(0,"Error","You've encountered error " & $err & ". Please click <a href="mailto:me@blah.com?subject='Error code" & $err &'>here</a> to e-mail me about it")

Is this at all possible?

Ta,

AC.

Not with the native MsgBox() function. You could code your own GUI dialog with perhaps a RichText Edit control that would permit hyperlinks. Failing that, you could even embed an instance of IE in a GUI control with HTML content.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Probably the easiest way to do this is to write an hta and call it from autoit and pass a parameter to it. An HTA is just locally run html. If you need help writing a very simple hta to meet your needs, post back I could work on it tonight.

Link to comment
Share on other sites

This might help


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Create a custom msgbox using an AutoIt GUI with a function to call the "mailto:"

The following will work with the default button being the Report button so pressing enter is the same as clicking the button.

#include <WindowsConstants.au3>
$err = "abcdefghi"
$Gw = 270
$Gh = 110
GUICreate('Error', $Gw, $Gh, -1, -1, BitOr($WS_POPUP, $WS_CAPTION,$WS_SYSMENU))
GUISetIcon("shell32.dll", -50)
$Lbl_1 = GUICtrlCreateLabel("You've encountered error " & $err & "." & @CRLF & @CRLF & _
      "Please click the report button to tell me about it.", 10, 20, $Gw -20, 40, 1)
$Btn_Report = GUICtrlCreateButton("Report", ($Gw/2) - 80, $Gh -35, 60, 25, 1)
$Btn_Cancel = GUICtrlCreateButton("Cancel", ($Gw/2) +20, $Gh -35, 60, 25)
GUISetState()

While 1
   $Msg = GUIGetMsg()
   Switch $Msg
      Case -3, $Btn_Cancel
         Exit
      Case $Btn_Report
         Report($err)
         Exit
   EndSwitch
WEnd

Func Report($sErr)
   $sAction = "mailto:me@blah.com?subject='Error code " & $sErr & "'"
   ShellExecute($sAction)
EndFunc

Edited the code for clarity.

Edited by GEOSoft

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!"

Link to comment
Share on other sites

Hey guys, thanks for all the speedy replies, have only just got round to reading them all now and I think the easiest one for me is to go with GEOSoft's suggestion.

Thanks a lot for all your help and replies :P

If you want to see another method of handling it you can take a look on my web site (link in my sig). Click on Code>>My Extra UDFs>>Dialog.au3. There is an "About" dialog in there that uses a label as a link.

EDIT: Also, instead of the GUI styles I used along with the blank icon take a look at this post where I modified @rovers code to make it a function for creating the window.

#654000

Edited by GEOSoft

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!"

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