on your revised code, try these....
/debug @blah1
(window created but no sound and/or message)
/window -c @blah2
(no window created but a sound and/or message)
On why a coder migth use !, basicly becuase they MIGHT, if this person was writting the code that opened the window they want a sound to play on opening, im sure they could just play the sound, so based from there request I would be quite sure that the code that opens the window(s) is not theres, I would beleive there attempting to play sounds to help notify them when a particular window from someone elses script opens.
Timers take stuff all resources, its not like Mircs going hard out now is it.
Why use timers when it can be done with your alias, basicly becuase your alias may or may not work depending on how the window was created.
I didnt have any code, so i wrote this just now, i test ran it and it seems to work ok, it might need more debugging but seemed ok, as an example, it deals with 3 windows it detects opening, giving a sound message for each if it detected an open, it also detects if the window was renamed to the window from another name, but wont detect a rename if the original window was closed at the same time (i do this to block windows being closed, using on close, i create a duplicate window, rename and let the old one close)
The code isnt optimized much as its just an example, also i wouldnt normally hard code 3 windows in, but rather use a hash table, but for the example i felt it was fine.
open.window.detector.startup {
;
; lets have 3 monitored windows, list the NAME STATUS(0=closed/1=open) SOUNDFILE
set %owd.window.data.1 @blah1 ? DF.MP3
set %owd.window.data.2 @debug ? DC.MP3
set %owd.window.data.3 @xdccklipper ? DS.MP3
;
; correct there STATUS
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
;
; Start the monitoring timer
.timer.open.window.detector -o 0 1 open.window.detector.timer
}
open.window.detector.timer {
;
; load w1,2,3 with window NAME & STATUS (used local vars as why do the gettoks in the if over and over %i times)
var %w1 = $gettok(%owd.window.data.1,1-2,32)
var %w2 = $gettok(%owd.window.data.2,1-2,32)
var %w3 = $gettok(%owd.window.data.3,1-2,32)
;
; loop through all the windows open
var %w
var %i = $window(0)
while (%i) {
;
; get CURRENTWINDOW
%w = $window(%i)
;
; if CURRENTWINDOW 0(closed) NAME & STATUS of a monitored window (and that STATUS is closed) then Play the open sound, cause its now open.
if (%w 0 == %w1) splay $gettok(%owd.window.data.1,3-,32)
if (%w 0 == %w2) splay $gettok(%owd.window.data.2,3-,32)
if (%w 0 == %w3) splay $gettok(%owd.window.data.3,3-,32)
;
; i cant rember why this is here <grin>
dec %i
}
;
; correct there STATUS (i thought about doing this in the If statments, it would reduce code per execution, but worried if there status could get outa sync with there real status)
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
}
(repeated below as inside code blocks it cant be copied ok)
open.window.detector.startup {
;
; lets have 3 monitored windows, list the NAME STATUS(0=closed/1=open) SOUNDFILE
set %owd.window.data.1 @blah1 ? DF.MP3
set %owd.window.data.2 @debug ? DC.MP3
set %owd.window.data.3 @xdccklipper ? DS.MP3
;
; correct there STATUS
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
;
; Start the monitoring timer
.timer.open.window.detector -o 0 1 open.window.detector.timer
}
open.window.detector.timer {
;
; load w1,2,3 with window NAME & STATUS (used local vars as why do the gettoks in the if over and over %i times)
var %w1 = $gettok(%owd.window.data.1,1-2,32)
var %w2 = $gettok(%owd.window.data.2,1-2,32)
var %w3 = $gettok(%owd.window.data.3,1-2,32)
;
; loop through all the windows open
var %w
var %i = $window(0)
while (%i) {
;
; get CURRENTWINDOW
%w = $window(%i)
;
; if CURRENTWINDOW 0(closed) NAME & STATUS of a monitored window (and that STATUS is closed) then Play the open sound, cause its now open.
if (%w 0 == %w1) splay $gettok(%owd.window.data.1,3-,32)
if (%w 0 == %w2) splay $gettok(%owd.window.data.2,3-,32)
if (%w 0 == %w3) splay $gettok(%owd.window.data.3,3-,32)
;
; i cant rember why this is here <grin>
dec %i
}
;
; correct there STATUS (i thought about doing this in the If statments, it would reduce code per execution, but worried if there status could get outa sync with there real status)
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
}
PS : the timer just goes off once a second, as i felt that was a fine rate of scanning, considering its a sound your playing to allert someone whoes then gonna take 10 seconds to get there anyway.