mIRC Home    About    Download    Register    News    Help

Print Thread
#117691 18/04/05 09:59 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
how could i get the event when i open a query window ... on open gets it when someone else opens it ...
10x for the help smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#117692 18/04/05 10:16 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
On Open triggers when you get a query window not when you open one.

#117693 18/04/05 10:31 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
yeah .. and i need to do something when i open a query ...
but never mind .. i figured something out...
Code:
filter -wf # $+ $target zzz.txt *
if ( $file(zzz.txt) == $null || $file(zzz.txt) == 0 ) {
    ***********************************
}


but now i dunno how to delete the session file zzz.txt ... what is the command ? smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#117694 18/04/05 10:34 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
nevermind ... figured that out too ... remove [-b] filename ...

sitll sleeping ... smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#117695 18/04/05 10:41 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
.remove zzz.txt.

Just one thing though you've got..

Code:
filter -wf # $+ $target zzz.txt *
if ($file(zzz.txt) == $null || $file(zzz.txt) == 0) {    
  ***********************************
}


Now if it's $null you don't need to check if the size is 0 do we? Too make the code shorter we can use the ! prefix to determine true of false.

Code:
filter -wf # $+ $target zzz.txt *
if ([color:red]![/color]$file(zzz.txt)) {    
  .remove zzz.txt
}


-Andy.

#117696 18/04/05 10:46 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
ofc ... i needed this because i did't know how to delete the file .. and if the query is empty .. it doesn't create a file .. so $null is matched .. but if a privious query .. wasn't empty.. the files is create .. and I couldn't delete it .. so if new query is opened .. the file will be sized '0' ... smile

with the remove command all that is needless smile

10x for the help ... and if there is any other way to do that .. i'm very curious about it wink


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#117697 18/04/05 10:47 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Code:
alias query {
  query $$1-
  ; your code
}


Or if you like to have the manual opening of a query triggered by an event, use a signal.

Code:
alias query {
  query $$1-
  .signal QOPEN $1-
}
 [color:red]  [/color] 
on *:SIGNAL:QOPEN:{
  ; your code 
}

/help signal to check out the options you have.

By scripting a custom query alias, it overrides the behaviour of the default one. If you want to trigger the default one, prefix the command with an exclamation mark !, like /!query or !query in scripts.

I've put "; your code" in the examples, but where you put it is up to you, you can put it in front of the actual query command so that things are done or checked prior to the opening of the query. Same goes for the signal, since it's the same principle.


Gone.
#117698 18/04/05 10:55 AM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
10x a lot ... still forgets the SIGNAL smile


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg
#117699 18/04/05 10:51 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Code:
filter -wf # $+ $target zzz.txt *
if ( $file(zzz.txt) == $null || $file(zzz.txt) == 0 ) {
    ***********************************
}


FiberOptics has given you the answer with alias query { ... } but im left wondering where you were going to insert your above quoted code anyway? I must know aghhhhhh!

#117700 21/04/05 01:44 PM
Joined: Sep 2004
Posts: 73
S
SteeleR Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Sep 2004
Posts: 73
Code:
on *:input:?:{
filter -wf # $+ $target $nick.txt *
if ( $file( $target $+ .txt ) == $null || $file( $target $+ .txt ) == 0 ) {
   echo -a Session is startded }
else {
   echo Session has already started
}
}


i was making a private logger by IP address smile

the code now looks like this:
Code:
#private_log on

alias query {
  query $$1-
  .signal QueryOpen $1-
}

on *:open:?:{
  write $mircdir $+ \logs\private\ $+ $right($address($nick,0),$calc($len($address($nick,0))-2)) $+ . $+ $server($server).group $+ . $+ $replace($date,/,.) $+ .log Session started at $time $date
}

on *:close:?:{
  write $mircdir $+ \logs\private\ $+ $right($address($nick,0),$calc($len($address($nick,0))-2)) $+ . $+ $server($server).group $+ . $+ $replace($date,/,.) $+ .log Session closed at $time $date
}

on *:text:*:?:{
  write $mircdir $+ \logs\private\ $+ $right($address($nick,0),$calc($len($address($nick,0))-2)) $+ . $+ $server($server).group $+ . $+ $replace($date,/,.) $+ .log  $chr(91) $+ $time $+ $chr(93) < $+ $nick $+ > $1-
}

on *:input:?:{
  if $left($1,1) != $chr(47) {
    write $mircdir $+ \logs\private\ $+ $right($address($target,0),$calc($len($address($target,0))-2)) $+ . $+ $server($server).group $+ . $+ $replace($date,/,.) $+ .log  $chr(91) $+ $time $+ $chr(93) < $+ $me $+ > $1-
  }
}

on *:SIGNAL:QueryOpen:{
  write $mircdir $+ \logs\private\ $+ $right($address($1,0),$calc($len($address($1,0))-2)) $+ . $+ $server($server).group $+ . $+ $replace($date,/,.) $+ .log Session started at $time $date
}

#private_log end


HanPeg HanPeg u BuHaru HanPeg nPu noPa}|{eHue kParoM u nAk HanPeg

Link Copied to Clipboard