mIRC Home    About    Download    Register    News    Help

Print Thread
on HOTLINK - Partial word match? #264202 09/11/18 02:12 AM
Joined: Nov 2018
Posts: 4
P
PineappleJerky Offline OP
Self-satisified door
OP Offline
Self-satisified door
P
Joined: Nov 2018
Posts: 4
mIRC succeccfully recognises URLs when the protocol is connected to another word, e.g. "https://google.com" is hover-able and click-able in "wordhttps://google.com". I cannot figure out how to recreate this behaviour, however.

As an example, I would like to match a single character inside a word. "e" should act as a hotlink in the word "hello", but "h" and "llo" should not. Is this possible?

A regex match captures the character easily, but the on HOTLINK event always matches the entire word, regardless.

Last edited by PineappleJerky; 09/11/18 02:12 AM.
Re: on HOTLINK - Partial word match? [Re: PineappleJerky] #264205 09/11/18 03:14 PM
Joined: Jul 2006
Posts: 3,790
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,790
Do you have any code currently?

Last edited by Wims; 09/11/18 03:44 PM.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: on HOTLINK - Partial word match? [Re: Wims] #264206 09/11/18 03:48 PM
Joined: Nov 2018
Posts: 4
P
PineappleJerky Offline OP
Self-satisified door
OP Offline
Self-satisified door
P
Joined: Nov 2018
Posts: 4
These examples explain no more than my original post, but here are some that do not do what I want:

Code:
on ^*:HOTLINK:*e*:*:{}

on HOTLINK will match all of the following: "e", "he", "ello" and "hello".

Code:
on $^*:HOTLINK:/(e)/:*:{}

$regml(1) will return "e" when it finds the word "hello", but $1 and $hotlink(match) will return "hello". The entire word "hello" will be 'hover-able' (the mouse turns into a pointing hand).

Last edited by PineappleJerky; 09/11/18 04:18 PM.
Re: on HOTLINK - Partial word match? [Re: PineappleJerky] #264207 09/11/18 05:20 PM
Joined: Jul 2006
Posts: 3,790
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,790
Ok, so it seems it's not possible to do this currently. on hotlink was meant to match on word, and there's no way currently to know what is the character under the mouse cursor.

However, the built-in hotlink feature is able to do that, I'm fairly certain that it should be possible for the on hotlink event to report such an information, but Khaled has stated that the built-in hotlink feature and the on hotlink event are different: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/262119/ & https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/262120/

I'd still ask for it in the feature suggestions forum.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: on HOTLINK - Partial word match? [Re: PineappleJerky] #264208 09/11/18 05:40 PM
Joined: Jan 2004
Posts: 1,588
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,588
I'm seeing what you describe. Also, $hotlinepos also returns the location of the beginning of the entire word. So you can identify which word containing e triggered the match, and $regml(1).pos returns the position within the word of the first match.

Re: on HOTLINK - Partial word match? [Re: PineappleJerky] #264210 09/11/18 09:07 PM
Joined: Nov 2018
Posts: 4
P
PineappleJerky Offline OP
Self-satisified door
OP Offline
Self-satisified door
P
Joined: Nov 2018
Posts: 4
Thanks, chaps

Edit for anyone following: Suggested here

Last edited by PineappleJerky; 10/11/18 12:13 AM.