From WikiChip
Difference between revisions of "mirc/identifiers/$target"
< mirc‎ | identifiers

(Created $target identifier - mIRC)
 
Line 23: Line 23:
 
   .auser 3 $address($nick,2)
 
   .auser 3 $address($nick,2)
  
   ; Set the window name to the dynamic $target identifier using
+
   ; Set the window name to the dynamic $target identifier
  ; evaluation [ [ ] ] brackets.
+
   %w = @ $+ $target
   %w = @ [ $+ [ $target] ]
 
  
 
   ; If the custom logging window is not open, create and  
 
   ; If the custom logging window is not open, create and  
Line 36: Line 35:
 
ON 3:TEXT:*:?: {
 
ON 3:TEXT:*:?: {
  
   ; Set the window name to the dynamic $target identifier using
+
   ; Set the window name to the dynamic $target identifier
  ; evaluation [ [ ] ] brackets.
+
   var %w = @ $+ $target
   var %w = @ [ $+ [ $target] ]
 
  
 
   ; If the custom logging window is not open, create and  
 
   ; If the custom logging window is not open, create and  
Line 55: Line 53:
 
   ; Input a request if the log window should be kept open
 
   ; Input a request if the log window should be kept open
 
   ; or closed.
 
   ; or closed.
   window - $+ $iif($input(Do you want to keep the log window open?,yi,Keep Log Window?),a,c) @ [ $+ [ $target] ]
+
   window - $+ $iif($input(Do you want to keep the log window open?,yi,Keep Log Window?),a,c) @ $+ $target
 
}</source>
 
}</source>
  

Revision as of 17:26, 24 June 2014

The $target identifier returns the target of an event. For instance, when a window closes, the ON CLOSE event triggers and $target is filled with the window name of that window.

Synopsis

$target

Examples

; When any window is closed, echo the window name
; to a custom @windowWatcher window. If that window doesn't exist,
; create it first.
 
ON *:CLOSE:*: {
  $iif(!$window(@windowWatcher),window @windowWatcher)
  echo @windowWatcher Window Closed: $target $+ .
}
; When a message is received in a query,
; open a new @window with the user's nickname and log the
; chat from there on out. If the window closes, stop logging.
 
ON *:OPEN:?:*: {
 
  ; Add the user to level 3 for logging
  .auser 3 $address($nick,2)
 
  ; Set the window name to the dynamic $target identifier
  %w = @ $+ $target
 
  ; If the custom logging window is not open, create and 
  ; minimize it.
  if (!$window(%w)) { window -n %w }
 
  ; If the user has sent data, log it to the custom window
  if ($1) { echo %w $1- }
}
ON 3:TEXT:*:?: {
 
  ; Set the window name to the dynamic $target identifier
  var %w = @ $+ $target
 
  ; If the custom logging window is not open, create and 
  ; minimize it.
  if (!$window(%w)) { window -n %w }
 
  ; Echo the contents of the message to the window.
  echo %w $1-
}
ON 3:CLOSE:?: {
 
  ; When the query window is closed locally or remotely,
  ; remove the user from the user level 3 for logging,
  .ruser 3 $address($target,2)
 
  ; Input a request if the log window should be kept open
  ; or closed.
  window - $+ $iif($input(Do you want to keep the log window open?,yi,Keep Log Window?),a,c) @ $+ $target
}

Compatibility

Added: mIRC v5.3

Added On: 13/12/97

See Also

ON OPEN ON CLOSE