mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2017
Posts: 5
S
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.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2017
Posts: 5
S
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.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2017
Posts: 5
S
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.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2017
Posts: 5
S
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.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2017
Posts: 5
S
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


Link Copied to Clipboard