Code:
; $connectcount returns the No. of currently connected status windows
alias connectcount {
  var %n = 0 
  scon -at1 inc % $+ n
  return %n
}