Project

General

Profile

[Script] Restore open query's

Added by Per Amundsen over 4 years ago

A user requested a way to save and restore open query's, so I made this little script.

Maybe someone else finds it useful.

Script:

on *:OPEN:?:*:{
  var %name = % $+ $network $+ _query
  set -s  [ %name ] $addtok( [ %name ] ,$target,32)
}

on *:CLOSE:?:{
  var %name = % $+ $network $+ _query
  set [ %name ] $remtok( [ %name ] ,$target,1,32)
}

raw 376:*:{
  openquerys
}

raw 422:*:{
  openquerys
}

alias query {
  var %name = % $+ $network $+ _query
  set [ %name ] $addtok( [ %name ] ,$1,32)
  !query $1-
}

alias -l openquerys {
  var %name = % $+ $network $+ _query , %s = 1

  while ($gettok( [ %name ] ,%s,32)) {
    if (!$query($v1)) {
      echo -s $gettok( [ %name ] ,%s,32)
      query $gettok( [ %name ] ,%s,32)
    }
    inc %s
  }
}