mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Any way to detect if a PM window has been active?

As in the active window. I can script something fine and well, i just cant think of if there is some type of identifier that tells me.

Specificly i want to reply to a PM that I havent looked at, with a autoreply message and or notify me with a echo to my active channel if im on the machine, but i dont want it straight away, i want that delayed some amount of time. I can easly set a timer up to do it, but just wondered, should i invoke a all PM wide reply is there a inbuilt method of detecting if the pm windiow has ever been made the actibve window (ie: i have looked at it already)

Joined: Oct 2005
Posts: 35
C
Ameglian cow
Offline
Ameglian cow
C
Joined: Oct 2005
Posts: 35
Edit: Sorry.. didnt read so closely.. sorry. Dont mind the following message.

hm.. I think that is rather easy...
Code:
on *:text:*:?: {
  beep 10 100
  echo Boing Boing!! You Got A Private Message!!
}

I felt like doing some more, but hey I have forgoten the syntax for time!! lol.
and a tip is not to use this. mIRC got a excellent feature for this in the options->sound check "beep on... Query messages". k?

Last edited by Crap; 06/11/05 10:17 AM.

#indierpgs @ magicstar.net Your indie-rpg fix. Online.
Joined: Jun 2005
Posts: 9
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jun 2005
Posts: 9
something like this?
Code:
On *:OPEN:?:*:set $+(%,openquery.,$nick)

On *:ACTIVE:?:{
  unset $+(%,openquery.,$active)
} 


this way when you click on a window query you unset the variable and you know you've seen it. Then you can add a timer to remind you all the unseen pm. Hope this can help you wink

Last edited by BeYonD_Me; 06/11/05 11:12 AM.
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Its a bit more complexe than that for me, im using multiple servers, and also want to deal with PM's that might auto close, or be manually closed by me without me actually making them the active window, this was the reason i put feelers out for if anyone knew of an internal identifier, something I wouldnt need to cover all possablities with. It however from my looking around appears there isnt one frown

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
That's an easy fix.. There's nothing exclusive to deal with query windows that I know of.

Code:
on *:open:?:*:{
  set %oquery. [ $+ [ $cid ] ] %oquery. [ $+ [ $cid ] ] $nick
  ; if you want to "check" to see if this query window is open at a later time, use a signal or something.
  ;.signal querycheck $cid $nick
  ; You can put that on a timer or something if you really want to run a check on it.
}
on *:active:?:{
  if ($istok(%oquery. [ $+ [ $cid ] ],$active,32)) {
    set %oquery. [ $+ [ $cid ] ] $remtok(%oquery. [ $+ [ $cid ] ],$active,32)
  }
}

Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Actually i disagree that that is the fix, the $nick cant track the window name as the pm window may change names, or maynot change names when a nick renames depending on common channels etc $window().wid is a better tracker, also the global SET can String to long errror on ya, and just the fact it can be damaged by almost any script that desiders to change it.
I have been using custom idetifiers accessing autoupdated and saved hashtables for a while now to aviod sets, unless its a -u set.

ex.
Code:
on *:open:?:*:{ $pms.value($window($nick).wid,$ctime) }
on *:active:?:{ $pms.value($window($active).wid,$null) }
;
alias pms.value {
   id ($0) {
      if (!$hget(pms.value)) { hmake pms.value }
      if ($isfile(pms.value.bin)) { hload -b pms.value pms.value.bin }
      if (($0 > 1)  { $iif($2-,hadd,hdel) pms.value $1 $2- | hsave -bo pms.value pms.value.bin }
      elseif ($0 = 1) { return $hget(pms.value,$1) }
   }
}


$pms.value(X) returns the value of item X
$pms.value(X,Y) sets item X to Y

Theres some extra bits to do with error checking in a normal one, but i hand wrote the alias in so didnt include all the bits.

Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
Almost forgot about nick changes, but you could easily just add an "on nick" event and just do:
set %blah $remtok(%blah,$nick,32)
set %blah %blah $newnick

*shrug* Just a few idea's. :P

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You probably want $window(<window>).sbcolor

Returns "message" if the window's switchbar button has the message colour, ie if it hasn't been looked at yet, otherwise $null.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Excellent, thanks man. Just what I needed.

I guess I should have used some type of display of them all and watched what might have chaneged before and after, but i just couldnt see anything that i precieved would have changed.

Just tried that out on where its needed and its working just as expected smile Thanks agian.


Link Copied to Clipboard