nisus.com
https://www.nisus.com/forum/

Convert Hyperlinks to HTML
https://www.nisus.com/forum/viewtopic.php?f=17&t=4206
Page 1 of 1

Author:  loulesko [ 2011-04-21 19:10:07 ]
Post subject:  Convert Hyperlinks to HTML

Here's a macro to convert Nisus Hyperlinks to HTML code. I use this as part of a macro that converts a Nisus document to blog friendly text. I thought it might be useful on its own.

If you have a word or a section of your Nisus document that is embedded with a hyperlink, this macro will select it and turn the blue underlined words into the display text and the underlying link into the href.

Again, my thanks to Kino. I took code from other things he's done on this forum to make this work.

Code:
Select Document Start
While Select Next Link
    $sel = TextSelection.active
    $text = $sel.subtext
    $attr = $sel.text.displayAttributesAtIndex $sel.location
    $url = $attr.link
    Set Link ''
    Insert Text "<a href=\"$url\">$text</a>"
end
Select End

Author:  martin [ 2011-04-22 15:54:20 ]
Post subject:  Re: Convert Hyperlinks to HTML

Thanks for taking the time to post your macros to the forum Lou- I appreciate that, as I'm sure others do.

One tip: you do not need to include naming directives in your macros, eg:
Code:
#NisusMacroProperty Name: Hyperlinks to HTML

By default NWP will use the macro's file name for the macro's name / menu title inside NWP. Including the directive is only necessary if you want to override the file's name.

You probably picked up the habit by looking at the macros we distribute with NWP. We include the naming directive in those macros because of localization, eg: if a user is running NWP in French, we want the macro's menu title to display in French as well. The naming directive also implies localization.

Author:  loulesko [ 2011-04-22 22:52:13 ]
Post subject:  Re: Convert Hyperlinks to HTML

Hi Martin,

Gotchya. Thanks for pointing that out. Much appreciated.

I edited the macro above.

Lou

Author:  bobmacatq [ 2011-04-24 17:49:30 ]
Post subject:  Re: Convert Hyperlinks to HTML

Folks!

I'm trying to use this macro and each time applescripteditor tells me it has a syntax error (something about finding 'while' instead of something else).

Can someone help?

Thanks!

Author:  loulesko [ 2011-04-24 21:54:51 ]
Post subject:  Re: Convert Hyperlinks to HTML

bobmacatq wrote:
Folks!

I'm trying to use this macro and each time applescripteditor tells me it has a syntax error (something about finding 'while' instead of something else).

Can someone help?

Thanks!


Hey there.
It's not an Apple Script it's Nisus Macro which you can install by checking our this link: http://nisus.com/forum/viewtopic.php?f=17&t=2097

Author:  bobmacatq [ 2011-04-25 05:23:23 ]
Post subject:  Re: Convert Hyperlinks to HTML

loulesko!

Thanks very much - don't know how I got the two confused!

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/