mIRC Home    About    Download    Register    News    Help

Print Thread
#48263 09/09/03 01:26 PM
L
Larra
Larra
L
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

Joined: Dec 2002
Posts: 2,958
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Dec 2002
Posts: 2,958
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.

Joined: Feb 2003
Posts: 2,737
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,737
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!
L
Larra
Larra
L
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

P
Propogater
Propogater
P
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]

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
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.

L
Larra
Larra
L
thank you guy, nice workaround

P
Propogater
Propogater
P
Thanks liner wink


Link Copied to Clipboard