mIRC Home    About    Download    Register    News    Help

Print Thread
#226677 11/10/10 04:24 PM
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
if I want to /play a file which has html tags in it can I strip out the html tags and just have plaintext played?

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can use an alias with /play. If you put the text through a $htmlfree identifier, you'll be able to play that without the html. There are many htmlfree identifiers that are available. Try searching here or on google.


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
thanks

for anyone else interested a good topic is here:

https://forums.mirc.com/ubbthreads.php?ubb=showflat&Number=209719&page=0&fpart=1

I tried:

Code:
alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $replace(%x, ,$chr(32))
  ; return %x
  /msg %x
}


which when used with:
/play -a htmlfree html.txt

works fine

but it seems on some lines it has nothing to message:

* /msg: insufficient parameters (line 137, test.mrc)

(I think the regex has parsed it to blank as the line only has tags in it)

How do I stop it doing /msg when it has nothing to msg?

on *:TEXT:*:#firefox: {
tokenize 32 $strip($1-)
if ($1 == !html) { /play -a htmlfree $chan html.txt }
}

Last edited by firefox; 12/10/10 04:11 PM.
Joined: Jul 2006
Posts: 4,185
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,185
Make a if ?
Also you should not use the htmlfree alias to send a msg to the channel, just keep it as it is so you can use it for the same purpose without sending a message :

Quote:
alias htmlfree return $regsubex($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,)
alias filterhtml if ($htmlfree($2-)) msg $1 $v1

/play -a filterhtml file


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
thanks Wims

I was doing my if on $1 which when used with play is the channel name iirc - doh!


Link Copied to Clipboard