Inspired by SEoD's niftykeen mirc script I sprang into action and wrote a script that brings the same e2 clickable link joy to the RISC OS IRC client, LIRC.

Disclaimer: For this script to work, you'll need a fairly recent version of LIRC. However, when LIRC runs it should tell if a newer version exists, so if you just get the latest, you'll be laughing. I will also accept no responsibility if things break due to my poor coding technique.

To install, create a new BASIC file named e2 in your Scripts directory, use the command /run e2 to activate the script and click, click, click-away!

If you want the script to run permanently, then simply add the line DO "/run e2" to your !OnConnect script, or, alternatively, copy the entire DEFEVENT block (lines 70-310) in there.

 10 TITLE e2
 20 AUTHOR "c-dub"
 30 REM makes [e2 links] clickable
 60 IDLE
 70 DEFEVENT(Launch,idx$,text$)
 80   REM search backwards for a [
 90   LET open%=0
100   FOR i%=VALidx$ TO 0 STEP -1
110     temp$=MID$(text$,i%,1)
120     IF temp$="[" THEN
130       open%=i%
140       i%=0
150     ENDIF
160   NEXT i%
170   REM search forwards for a ]
180   temp$=MID$(text$,open%)
190   close%=INSTR(temp$,"]")
200   IF close%>2 AND open%+close%>VALidx$ THEN
210     REM found a string!
220     temp$=MID$(text$,open%+1,close%-2)
230     REM convert all the spaces to +'s
240     WHILE INSTR(temp$," ")<>0
250       MID$(temp$,INSTR(temp$," "),1)="+"
260     ENDWHILE
270     temp$ = "/url"+temp$
280     DO "<-=click=->"
290     DO temp$
300   ENDIF

All copied? Then you're all set! Now, whenever you see something along the lines of [What Would Jackie Chan Do?] in a LIRC window you can simply double-click on it and it'll launch in a fresh new browser window.


Log in or register to write something here or to contact authors.