mIRC Home    About    Download    Register    News    Help

Topic Options
#259948 - 14/02/17 09:38 AM Change the browser to open urls within mIRC?
singularity Online
Nutrimatic drinks dispenser

Registered: 14/02/17
Posts: 5
My system default browser is chrome. I would like mIRC to open urls in chat via firefox. Is there any way or script to make that possible?

OS : Windows 10
mIRC : 7.47


Edited by singularity (14/02/17 02:58 PM)

Top
#259949 - 14/02/17 09:49 AM Re: Change the browser to open urls within mIRC? [Re: singularity]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3067
Loc: France
It's possible with a script yes, put that in your remote, you must be using at least mIRC 7.23:

Code:
on $*:hotlink:$($url_pattern):*:if ($hotlink(match).type == url) && ($hotlink(event) == dclick) { run firefox $1- | return }
alias url_pattern return m@((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(?:/((?:[-a-zA-Z;./\d#:_?=&,]*)))?)@ig


@Khaled: the new on hotlink syntax with $hotlink etc is missing in the help file, it's only documented in versions.txt.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#259957 - 14/02/17 02:29 PM Re: Change the browser to open urls within mIRC? [Re: Wims]
singularity Online
Nutrimatic drinks dispenser

Registered: 14/02/17
Posts: 5
Originally Posted By: Wims
It's possible with a script yes, put that in your remote, you must be using at least mIRC 7.23


I am on 7.47. I already have a on start script connecting to ZNC in remote. How do I add this?
I cant seem to get it to work. Urls still open in default browser chrome.


--------------
update : saved it as a fresh remote script and now it works. Thanks a lot

I modified to work as single click

Code:
on $*:hotlink:$($url_pattern):*:if ($hotlink(match).type == url) && ($hotlink(event) == sclick) { run firefox $1- | return }
alias url_pattern return m@((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(?:/((?:[-a-zA-Z;./\d#:_?=&,]*)))?)@ig


Is this correct?
And this disables the url right click contect menu?


Edited by singularity (14/02/17 02:54 PM)

Top
#259968 - 15/02/17 01:13 PM Re: Change the browser to open urls within mIRC? [Re: singularity]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3067
Loc: France
You are right, here is an update, to allow default processing for other event than double click (allowing the default rclick menu), and because there was an error in the pattern and in the code anyway, which would incorrectly match some urls.

Code:
on $*:hotlink:$($url_pattern):#:if ($hotlink(match).type == url) && ($hotlink(event) == dclick) { run firefox $regml(1) | return } | halt
alias url_pattern return m@((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(?:/((?:[-a-zA-Z;./\d#:_?=&]*)))?)@ig
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#259971 - 15/02/17 04:37 PM Re: Change the browser to open urls within mIRC? [Re: Wims]
singularity Online
Nutrimatic drinks dispenser

Registered: 14/02/17
Posts: 5
Originally Posted By: Wims
You are right, here is an update, to allow default processing for other event than double click (allowing the default rclick menu), and because there was an error in the pattern and in the code anyway, which would incorrectly match some urls.

Code:
on $*:hotlink:$($url_pattern):#:if ($hotlink(match).type == url) && ($hotlink(event) == dclick) { run firefox $regml(1) | return } | halt
alias url_pattern return m@((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(?:/((?:[-a-zA-Z;./\d#:_?=&]*)))?)@ig




Perfect!! Now that gives the ability to run both options.. default browser by contect menu and chosen browser by double/single click.
Thanks a lot.

Top
#259972 - 15/02/17 06:12 PM Re: Change the browser to open urls within mIRC? [Re: singularity]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3067
Loc: France
You're welcome, I'm actually going to use this code to keep improving the regex pattern so that it matches what mIRC is doing correctly.

Here is another update of the code:

Code:
on $*:hotlink:$($url_p):*:if ($hotlink(match).type == url) && ($hotlink(event) == dclick) { run firefox $regml(2) | return } | halt
alias url_p return m@(["']?)((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(/(?:[^ ]*))?)\1@igS
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#259973 - 15/02/17 07:04 PM Re: Change the browser to open urls within mIRC? [Re: Wims]
singularity Online
Nutrimatic drinks dispenser

Registered: 14/02/17
Posts: 5
Originally Posted By: Wims
You're welcome, I'm actually going to use this code to keep improving the regex pattern so that it matches what mIRC is doing correctly.


Great! If it is not trouble kindly add different versions for other popular browsers : chrome , edge, IE, Yandex, FF developer edition, Palemoon etc or what parameter to change.

Should we enter just the name of the browser or absolute path to the executable?


Edited by singularity (15/02/17 07:06 PM)

Top
#259974 - 15/02/17 07:22 PM Re: Change the browser to open urls within mIRC? [Re: singularity]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3067
Loc: France
Well yeah, adding the absolute path is always going to work, but when I tried it I thought let's see if I can just use firefox, meaning that firefox would have registered its path either in the PATH variable environement, or inside a key in the registryIf others browser are doing that as well, it will work and is 'portable'. I figured I'd keep it because if it works it's a better solution, you can share the code with someone without modification, I just tested it with chrome and it's working for me.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#260289 - Yesterday at 11:21 PM Re: Change the browser to open urls within mIRC? [Re: Wims]
singularity Online
Nutrimatic drinks dispenser

Registered: 14/02/17
Posts: 5
Originally Posted By: Wims
Well yeah, adding the absolute path is always going to work, but when I tried it I thought let's see if I can just use firefox, meaning that firefox would have registered its path either in the PATH variable environement, or inside a key in the registryIf others browser are doing that as well, it will work and is 'portable'. I figured I'd keep it because if it works it's a better solution, you can share the code with someone without modification, I just tested it with chrome and it's working for me.


I recently installed Firefox Developer Edition , which installs as separate Mozilla browser with it's own profile. But since installing it , links open in Dev edition and not in Noral Stable Mozilla Firefox. I ha dto edit the script with absolute path to make it work. I am confused why would "firefox" trigger developer edition and not stable edition.

Code:
on $*:hotlink:$($url_p):*:if ($hotlink(match).type == url) && ($hotlink(event) == sclick) { run C:\Program Files (x86)\Mozilla Firefox\firefox.exe $regml(2) | return } | halt
alias url_p return m@(["']?)((?:(?:https?|ircs?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(/(?:[^ \n]*))?)\1@igS

Top