The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

slrn: Launching URLs

Contributed by: Tim Vernum
This tip is valid for: Both BeOS and Haiku

If you use slrn as a newsreader and want to be able to have URLs embedded in articles opened in NetPositive automatically, save the script below to ~/config/bin/OpenURL. Then open your .slrnrc file, search for the section “% WWW browser to use” and add these two lines:

set non_Xbrowser "OpenURL --url -w 2 '%s' &"
set Xbrowser "OpenURL --url -w 2 '%s' &"

Change the “2”s to the number of the workspace you want NetPositive to be launched in. Quit and restart slrn if necessary. Now find an article containing a URL, and press “U” (uppercase, not lowercase). If the article contains just one URL, it will appear in the status bar. Press Enter to launch it. If the article contains more than one URL, they’ll appear in a menu — use the arrow keys to choose a URL from the list.

Here’s the OpenURL script. Be sure to tweak the last section of the script to tell it whether to use Pe or Eddie as your main editor.

URL=0

while [ $# -ge 1 ]
do
        case $1 in
                -w | --workspace)
                        WORKSPACE=$2
                        shift
                        ;;
                -f | --file)
                        URL=0
                        ;;
                -u | --url)
                        URL=1
                        ;;
                -*)
                        ;;
                *)
                        STRING="$STRING $1"
                        ;;
        esac
        shift
done

if [ $WORKSPACE ]
then
        let WS=${WORKSPACE}-1
        Workspaces $WS
fi

if [ "$URL" -eq 1 ]
then
        NetPositive $STRING
fi


Posted in Applications


(comments are closed).