Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2010 by Barry MacDonnell. All Rights Reserved.

Page updatedSep 2, 2009
LinkToURL - Automates the creation of an active hyperlink in a WordPerfect document from a selected Internet address (URL)

Download LINKTOURL.ZIP
(v1.01; 05/27/09; 8,755 bytes)

Compatible with WordPerfect X4 (may also work in earlier versions back to WP9)

WordPerfect 11 users: See important information about using macros in the first release of WP11 (11.0.0.233) at the top of this page.

Macro download and installation
instructions for new users

 

Background

There are two basic issues this WordPerfect 9+ macro addresses:

(1) Under normal conditions, if these two WordPerfect features are enabled (i.e., ticked) --

Activate Hyperlinks (under Tools, Settings, Environment), and
Format words as hyperlinks when you type them (under Tools, QuickCorrect, SpeedLinks)

-- then typical Internet website addresses (URLs), when pasted into WordPerfect and then immediately followed by a space character, will become active hyperlinks.

But some URLs will not be automatically converted. For example:

This will become active:
http://www.wpuniverse.com/vb/showthread.php?s=&postid=195039

This will not:
http://www.wpuniverse.com/vb/showthread.php?s=&postid=195039#post195039

(2) Another way to create a hyperlink to an Internet website address is to

  • select the address, then
  • copy it to the clipboard (Ctrl+c), then
  • click on Tools, Hyperlink and then
  • paste it (Ctrl+v) into the dialog's Document/Macro field, and then
  • click OK. [Lots of steps!]

Functions

This macro solves many problems (but not all: see below) with creating a hyperlink from a too-long Internet address, and it also eliminates at least two of the manual steps above (even more, if you must first copy and paste the URL into WordPerfect).

It will take either the most recent selected Internet address (i.e., an URL) in a WordPerfect document, or if nothing was selected, the last item in the Windows clipboard (presumably, an URL selected in a web browser or other source), and make it into a clickable hyperlink at the current cursor location, all with a single mouse click.

Of course, this presumes you have just selected an Internet URL and not something else! The macro will perform a rudimentary check to see if at least the four characters, "http," are present in the selected text.

Important: The macro processes just one URL at a time, not a group of selected URLs. See akso "Why some hyperlinks can fail to work while inside WordPerfect documents."

Instructions

(1) Select an URL from your browser's address field, a web page, or other document including any WordPerfect document.

(2) Copy the selection with Ctrl+c.

Note that -

If you selected the URL in your browser or other source outside of WordPerfect, be sure to copy it to the clipboard with Ctrl+c. However ... If you selected the URL from elsewhere in the current WordPerfect document (e.g., by triple-clicking on it), and leave it selected when you play the macro, the selection will be replaced by a clickable hyperlink. In this latter case, you don't have to also copy it to the clipboard as you would if it were selected in another program (e.g., your web browser).

You can place the cursor in your WordPerfect document at another location where you might wish to create the hyperlinked item. The macro will simply create it at that location.

(3) Play the macro. (It can be assigned later to Ctrl+Alt+k, which is used by Microsoft Word for the same purpose, or any other available keyboard shortcut. See http://wptoolbox.com/tips/EasyPlay.html.)

Limitations, Notes and Tips

(1) There seems to be an internal character limit to the HypertextCreate() macro command. Therefore, this macro limits long URLs to 235 characters. And it may not work with some shorter URLs,. But for most URLs it should make creating active hyperlinks a little easier.

(2) Once the link is created, the Windows clipboard is emptied, ready for the next select-and-create-link operation. (This prevents accidentally pasting a previous selection of text between the paired [Hyperlink] codes when conducting multiple, sequential link operations during a session.) You can disable this clipboard flushing feature with a setting in the redlined User Modification Area in the macro's code.

(3) Ordinarily, two WordPerfect options should be enabled to globally (a) activate all hyperlinks in WordPerfect and (b) (optionally) format Internet addresses as hyperlinks while you are typing them in a document: Activate Hyperlinks (under Tools, Settings, Environment), and Format words as hyperlinks when you type them (under Tools, QuickCorrect, SpeedLinks).

However, you do not need to turn on the global setting, Activate Hyperlinks, if you prefer it to be off. The macro will automatically activate the hyperlink (but for the current document only), regardless of that setting.

Also, you do not need to enable "Format words as hyperlinks as you type them," since this macro works on items that were already typed—presumably properly formatted—into a document, or on items that were selected in a web browser or similar source (hence, also presumably formatted as an URL). In fact, the macro can be used on long URLs that WordPerfect might not format as a hyperlink because of an internal limit on the maximum length of the URL.

(4) Related macros:

You might be interested in SoftWrap.wcm, which can format long URLs so that they wrap normally (i.e., break apart at logical places) if they are pushed to the end of a line, instead of wrapping as a block to the next line. SoftWrap can be played on a selected URL in WordPerfect either before or after playing LinkToURL on the same text.

To create "round trip" hyperlinks to let you quickly jump between a particular footnote or endnote number in a document to the footnote or endnote itself -- and vice versa -- with a mouse click, see LinkNotes.wcm.