Login / Register
▼
Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
VoiceBot
WallpaperFusion
▼
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
▼
Features
Features
HotKeys
Macros
Triggers
Clipboard Syncing
Clipboard Manager
Languages
Free vs Pro
Purchase
Screenshots
Apps
▼
Online
Online
Recent Items
Pinned Items
▼
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Macros
Languages
Clipboard
Fusion
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Search for URL and Make Anchor
Return to ClipboardFusion Macros
Description
This macro will replace the first URL in the selected text with the URL converted to an HTML link.
Language
C# (.Net)
Minimum Version
5.8.5+
Created By
Thomas Malloch (BFS)
Contributors
-
Date Created
Jan 26, 2021
Date Last Modified
Jan 26, 2021
Macro Code
Copy
Select All
Toggle Line Wrapping
using System; using System.Web; using System.Collections.Generic; // The 'text' parameter will contain the text from the: // - Current Clipboard when run by HotKey // - History Item when run from the History Menu // The returned string will be: // - Placed directly on the Clipboard when run as a Macro // - Ignored by ClipboardFusion if it is 'null' // - Passed along to the next action in a Trigger (null changed to an empty string) public static class ClipboardFusionHelper { public static string ProcessText(string text) { // Get the highlighted text text = BFS.Clipboard.CopyText(); // Search the Clipboard History for a URL for(int i = 0; i < BFS.ClipboardFusion.GetHistoryItemCount(); i++) { // If there's no text, it can't be a url if(!BFS.ClipboardFusion.GetHistoryIndexContainsText(i)) continue; // See if Uri.TryCreate can succeed string history = BFS.ClipboardFusion.GetHistoryText(i); Uri result; if((history.IndexOf("http") != 0) || (!Uri.TryCreate(history, UriKind.Absolute, out result))) continue; // Paste what we found BFS.Clipboard.PasteText("<a href=\"" + history + "\">" + HttpUtility.HtmlEncode(text) + "</a>"); break; } return null; } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get Binary Fortress Merch