mIRC Home    About    Download    Register    News    Help

Print Thread
#53074 09/10/03 11:16 AM
Joined: Dec 2002
Posts: 292
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 292
Hi, ok was reading the mIRC help file and came across "ON EXIT", read up on it, thought i'd give it ago.

*background info*
I have a few groups setup and enabled but i sometimes quit mIRC and forget to disable them and then when i next run mIRC the program complains that groups are still enabeled and messes up so i have to disable them, quit the server and then rejoin again.

*the solution*
I wanted to be able to disable a group that i had accidently forgotton to disable and thought on exit would do the job,
however i seem to be having a problem with it.

*the problem*
The problem is it wont disable the group

Code:
ON *:EXIT {
  if ($group == #exit enable) {
  }
  else {
    ($group == #exit disable)  }
}


Also i wanted it to play a wav to say i was disconnected from the server and then copy my mIRC.ini file to a location of my choice, how would i do this ?

I came up with this
Code:
ON *:EXIT {
  if ($group == #pmask enable) {
  }
  else {
    ($group == #pmask disable | splay disconnect.wav | copy $mircdir/mirc.ini D:\ )
  }
}


Maybe my problem lies in the IF and ELSE so i read up in the help file again they look alright, ieven put the pipes ( | ) in to seperate the splay and copy commands, maybe they are wrong, i dunno maybe the whole script is messed up.

Thanks in advance to anybody who can help me sort this one out
ShadowDemon
mIRC V6.1

#53075 09/10/03 11:27 AM
Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
Code:
ON *:EXIT: {  
  [color:green]; copy this for each group[/color]
  if ($group(#groupname) == on) .disable #groupname 
  [color:green]; copy the mirc.ini[/color]
  .copy mirc.ini c:\
} 

#53076 09/10/03 11:32 AM
A
Agent_Mike
Agent_Mike
A
ok, this part:
Code:
ON *:EXIT { 
 if ($group == #exit enable) {  } 
else {    ($group == #exit disable)  }
} 

won't do anything, you don't have the comands, and you need to make sure you created the identifier $group (and that you aren't confusing with a variable %), and also you need another : after the EXIT.
Code:
 on *:EXIT: { <the command to disable the group> } 


and about the second part,
Code:
 ON *:EXIT {  
if ($group == #pmask enable) {  }  
else {    
($group == #pmask disable | splay disconnect.wav | copy $mircdir/mirc.ini D:\ )  }
} 


in this part you also need the : after EXIT, and again you use if but you don't have the commands to cancel the group in the { } also you don't need to put the commands in the else { } in parenthesis.

#53077 09/10/03 11:33 AM
Joined: Dec 2002
Posts: 292
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 292
Arrgghh, Thanks one again LocutusofBorg blush

It works great

#53078 09/10/03 11:38 AM
Joined: Dec 2002
Posts: 292
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 292
hehe, thanks AgentMike, i alwasy seem to forget the : after the ON events

LocutusofBorg fixed it for me, but i will consider your options too, especially the second bit.

Wasnt sure about the $group and assumed it was needed, checked the help file and read it and the re-read it, maybe i got confused as i have never used this set of event before in a script i have made. confused

#53079 09/10/03 11:41 AM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
If you want to play a sound when you disconnect then use on DISCONNECT. on EXIT is triggered when mIRC closes, so it can't play a sound for long then (unless put it into an loop for a while).

Also the if in locutus' script isn't really needed. If you're going to distribute the script you will also probably want to use $shortfn($mircini) instead of mirc.ini, since not all users use mirc.ini (they might use bob.ini or jim.ini depending on who is using it).

#53080 09/10/03 11:54 AM
Joined: Dec 2002
Posts: 292
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Dec 2002
Posts: 292
Thanks Collective for you help

The script is for my own personal use. was wanting a way to copy my mirc.ini file to a safe location just incase my scripts get unloaded again, but seems Khaled has "fixed" it unloading in V6.1 (just a wild guess, cos it aint happened since V6.1 came out)

Yes i have an "on disconnect" script i was playing with and was considering using that and NOT having it in the "on exit" script.

The "on disconnect" script is not loaded at the mo, cos i was testing the "on exit" on another running copy of mirc on my test server.

Yeah i understand what you saying about the difference between on disconnect and on exit now, and taken into consderation

#53081 11/10/03 02:18 AM
I
Iori
Iori
I
copy -o $+(",$mircini,") C:\
The -o switch to overwrite any existing file of that name instead of an error. wink


Link Copied to Clipboard