mIRC Home    About    Download    Register    News    Help

Print Thread
Change the browser to open urls within mIRC? #259948 14/02/17 09:38 AM
Joined: Feb 2017
Posts: 5
S
singularity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Feb 2017
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

Last edited by singularity; 14/02/17 02:58 PM.
Re: Change the browser to open urls within mIRC? [Re: singularity] #259949 14/02/17 09:49 AM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
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
Re: Change the browser to open urls within mIRC? [Re: Wims] #259957 14/02/17 02:29 PM
Joined: Feb 2017
Posts: 5
S
singularity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Feb 2017
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?

Last edited by singularity; 14/02/17 02:54 PM.
Re: Change the browser to open urls within mIRC? [Re: singularity] #259968 15/02/17 01:13 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
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
Re: Change the browser to open urls within mIRC? [Re: Wims] #259971 15/02/17 04:37 PM
Joined: Feb 2017
Posts: 5
S
singularity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Feb 2017
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.

Re: Change the browser to open urls within mIRC? [Re: singularity] #259972 15/02/17 06:12 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
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
Re: Change the browser to open urls within mIRC? [Re: Wims] #259973 15/02/17 07:04 PM
Joined: Feb 2017
Posts: 5
S
singularity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Feb 2017
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?

Last edited by singularity; 15/02/17 07:06 PM.
Re: Change the browser to open urls within mIRC? [Re: singularity] #259974 15/02/17 07:22 PM
Joined: Jul 2006
Posts: 3,588
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,588
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
Re: Change the browser to open urls within mIRC? [Re: Wims] #260289 25/03/17 11:21 PM
Joined: Feb 2017
Posts: 5
S
singularity Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Feb 2017
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