mIRC Home    About    Download    Register    News    Help

Topic Options
#48263 - 09/09/03 02:26 PM multiple instances of mIRC
Larra Offline
Ameglian cow

Registered: 09/12/02
Posts: 39
Loc: Spain
I think it could be nice if mIRC had a feature to prompt a message when you open a second instance of mIRC.
Of course it should have the option to turn it off.
That would be also useful for scripters that forget they have another instance of mIRC and overwrite script files hehe

Top
#48264 - 09/09/03 09:45 PM Re: multiple instances of mIRC
Watchdog Offline
Hoopy frood

Registered: 09/12/02
Posts: 2984
Loc: Hill End, NSW, Australia
Not a bad idea. This will get you by in the meantime:
Code:
ON *:START: {
  if (%ws.mirctime == $null) {
    set %ws.mirctime $file(mirc.exe).atime
  }
  .timermt 0 600 mirctime
}
alias mirctime {
  if ($file(mirc.exe).atime > %ws.mirctime) {
    echo -ta You have more than one instance of mIRC running.
  .timermt off
  }
}
ON *:EXIT: {
  unset %ws.mirctime
}
This is a bit rough but basically it checks for a second instance every five minutes.
_________________________
Induced IRC
irc.induced.net

Top
#48265 - 09/09/03 09:48 PM Re: multiple instances of mIRC
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2597
You could also check the DDE server. When you have multiple instances of the same mIRC running (same settings, et al) then all subsequent instances will have an inoperable DDE Server.

You could try setting a variable through /dde and see if that variable gets set properly.
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#48266 - 09/09/03 10:31 PM Re: multiple instances of mIRC
Larra Offline
Ameglian cow

Registered: 09/12/02
Posts: 39
Loc: Spain
Nice replies. I currently use a script similar to Watchdog's, but writing to a file (mirc.pid)
However, this is a little ugly workaround imho, so I think khaled should consider.
Thanks in advance smile

Top
#48267 - 09/09/03 11:28 PM Re: multiple instances of mIRC
Propogater Offline
Ameglian cow

Registered: 10/08/03
Posts: 19
Well, you could do this by simply setting a %var and increase it whenever you start mIRC, but this way is a little bit cooler, IMHO wink

The principle behind this is that you start and name a DDE Server whenever you open up mIRC. If you then already are running an instance of mIRC, it will shut down the newly opened program.

I just made it simple and it may be malfuntioning every now and then, but hopefully it will give you an idea of how to do it

Your'n

Code:
  
on *:START:{ 
  inc %i 
  DDESERVER ON $+(mIRC,%i) 
  [color:green];We start the DDE Server and name it mIRC2 for example[/color] 
  if ($dde($+(mIRC,$calc(%i - 1)),connected)) {
    [color:green];if $dde(mIRC1,connected) returns something, there is another instance of mIRC running. [/color] 
    [color:green];You could use $ddename instead, but this would give people an idea of how to use $dde.[/color] 
    dde mirc1 command "" /ECHO -ag * The other instance of mIRC has been shut down
    [color:green];Let us echo to our first instance that we shut down the newly opened mIRC[/color] 
    exit
    [color:green];And here we exit that instance.[/color] 
  }
}
on *:EXIT:dec %i
[color:green];And then we need to decrease %i whenever we exit mIRC[/color]
_________________________
Propogater @ DALnet, #HelpDesk and #Help

Top
#48268 - 10/09/03 01:37 AM Re: multiple instances of mIRC
Online Offline
Hoopy frood

Registered: 09/12/02
Posts: 1922
Hey Prop, it's nice to see you writing here smile

If anyone is interested, here's another solution posted to this board a while ago.

Top
#48269 - 10/09/03 01:42 AM Re: multiple instances of mIRC
Larra Offline
Ameglian cow

Registered: 09/12/02
Posts: 39
Loc: Spain
thank you guy, nice workaround

Top
#48270 - 10/09/03 08:07 AM Re: multiple instances of mIRC
Propogater Offline
Ameglian cow

Registered: 10/08/03
Posts: 19
Thanks liner wink
_________________________
Propogater @ DALnet, #HelpDesk and #Help

Top