Jump to content

Recommended Posts

Posted (edited)

I think RichEdit has been my favorite thing I've ever discovered on AutoIt lol. In my quest to add in more html tags to my _StringToRichEditArray I needed a way to do href! There was an example I found that I followed but it didn't format correctly and didn't work 100% but it gave me a good base. Think I'll tackle inserting an image next, not looking forward to that. If anyone has an idea on how to do it let me know.

Known issues (these will cause the hyperlink to lose the +li attribute after the RichEdit is updated):

  1. The hyperlink and friendly text are appended/inserted (directly adjacent to a non whitespace) but the hyperlink is not a valid hyperlink.
  2. Changing the char color for the control causes the hyperlink to lose it's hyperlink color (the light blue).

Fix for Issue 1:

  • Use the full URL for the hyperlink (https://www.autoitscript.com/site/ instead of www.autoitscript.com/site)
  • Use any hyperlink with any friendly text that does not have www at the beginning (Hyperlink: www.google.com, Friendly Text: google.com)
  • Use any hyperlink with any, or no, friendly text, but have a whitespace to the left of the hyperlink.

Fix for Issue 2:

  • I have no fix.

Updated RichEdit Hyperlink.au3

  Reveal hidden contents

Demo

  Reveal hidden contents

Original Post, outdated: Had a problem with inserting/appending hyperlinks that pointed to the local computer. (C:\Windows\)

  Reveal hidden contents

 

 

Edited by InunoTaishou
Posted

Updated. Didn't realize that local paths for the hyperlink weren't being set correctly. This works with website URLs and local paths. Also severely shortened the Insert function and took out a lot of things that could cause errors, now there's only 3 possible @Error codes, and only one is an actual RichEdit error.

If anyone is ever looking for inserting an image into a RichEdit control (which I mentioned I was going to attempt to do), UEZ has pretty much done all the necessary code. I did change a couple of things to it to clean it up and will be adding the option to pass an $hBitmap or a file path but I see no point in re-releasing existing, working code, with small tweaks.

  • 5 years later...
  • 1 year later...
Posted

Sorry for resurrecting an OLD thread however this is a quite useful piece of code so I wanted to provide a solution for issue #2.

It simply requires an ABGR value instead of RGB.

In "RichEdit Hyperlink.au3"

Global Const $COLOR_HYPERLINK = "0x00" & Hex(_WinAPI_SwitchColor(0xCC6600), 6)

 

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
×
×
  • Create New...