Window Manager

By Battlemonkey on Jan 29, 2010

This snippet manages your queries/@windows/channels. Just right-click anywhere and click Window manager and you're good to go. Thanks to Scakk for the /htsave and /htload aliases.

alias updatepms {
  did -r wm 11
  var %t 1
  while (%t <= $query(0)) {
    did -a wm 11 $query(%t)
    inc %t
  }
}
alias updatechans {
  did -r wm 6
  var %t 1
  while (%t <= $chan(0)) {
    did -a wm 6 $chan(%t)
    inc %t
  }
}
alias updatewindows {
  did -r wm 16
  var %t 1
  while (%t <= $window(0)) {
    did -a wm 16 $window(%t)
    inc %t
  }
}
alias updatenetworks {
  $iif(!$hget(NetworksForWM), hmake NetworksForWM)
  did -r wm 19
  var %t 1
  var %origserver $network
  while (%t <= $scon(0)) {
    scid $scon(%t)
    did -a wm 19 $network
    hadd NetworksForWM $network $scon(%t)    
    inc %t
  }
  var %i = 1
  while (%i <= $hget(0)) { 
    hsave -s $hget(%i) $hget(%i) $+ .dat  
    inc %i 
  }
}
dialog wm {
  Title "Window Manager"
  Size -1 -1 200 100
  option dbu
  tab "Channels", 1, 5 3 190 80
  tab "PMs", 2, 10 3 190 80
  tab "@ Windows", 3, 15 3 190 80
  button "Join Channel", 4, 10 38 45 15,disable,tab 1
  edit "", 5, 10 20 45 15,tab 1
  list 6, 70 20 50 50,tab 1
  button "Leave Channel", 7, 130 45 43 20,disable,tab 1
  button "Message Channel", 8, 128 20 47 20,disable,tab 1
  button "PM Nick", 9, 14 39 30 15,disable,tab 2
  edit "", 10, 10 20 45 15,tab 2
  list 11, 70 20 50 50,tab 2
  button "Close PM", 12, 130 45 30 20,disable,tab 2
  button "Message Nick", 13, 126 20 40 20,disable,tab 2
  button "New Window", 14, 12 37 38 15,disable,tab 3
  edit "", 15, 10 20 45 15,tab 3
  list 16, 70 20 50 50,tab 3
  button "Close Window", 17, 128 45 38 20,disable,tab 3
  button "Add Line to Window", 18, 122 20 53 20,disable,tab 3
  combo 19, 10 65 50 50,drop,hide
  box "Network", 20, 7 55 60 25,disable,top,hide
}
on *:dialog:wm:init:*: {
  updatepms
  updatechans
  updatewindows
  updatenetworks
  if ($scon(0) > 1) did -e wm 19,20
}
on *:dialog:wm:sclick:4: {
  if ($regex($did(5),/^$chr(35)/Si)) join $did(5)
  else join $chr(35) $+ $did(5)
}
on *:dialog:wm:edit:5: {
  if ($did(5)) did -e wm 4
  if (!$did(5)) did -b wm 4
  if ($chr(32) isin $did(5)) {
    did -b wm 4
    noop $input(Channels can not have spaces in them. Please try again.,ao,ERROR)
  }
}
on *:dialog:wm:sclick:7: {
  leave $did(6).seltext
  updatechans
}
on *:dialog:wm:sclick:9: {
  query $did(10)
  updatepms
}
on *:dialog:wm:sclick:6: {
  if ($did(6).seltext) did -e wm 7,8
}
on *:dialog:wm:sclick:8: {
  msg $did(6) $input(Please enter your message,aoe,Message $did(6))
  noop $input(Your message has been sent,ao,Message Sent)
}
on *:dialog:wm:edit:10: {
  if ($did(10)) did -e wm 9
  if (!$did(10)) did -b wm 9
  if ($chr(32) isin $did(10)) {
    did -b wm 9
    noop $input(Nicknames can not have spaces in them. Please try again.,ao,ERROR)
  }
}
on *:dialog:wm:sclick:12: {
  close -m $did(11).seltext
  updatepms
}
on *:dialog:wm:sclick:11: {
  if ($did(11).seltext) did -e wm 12,13
}
on *:dialog:wm:sclick:13: {
  msg $did(11) $input(Please enter your message,aoe,Message $did(3))
  noop $input(Your message has been sent,ao,Message Sent)
}
on *:dialog:wm:sclick:19: {
  scid $hget(NetworksForWM,$did(19))
  updatepms
  updatechans
  updatenetworks
}
on *:dialog:wm:sclick:14: {
  if ($regex($did(15),/^$chr(64)/Si)) window -a $did(15)
  else window -a $chr(64) $+ $did(15)
}
on *:dialog:wm:edit:15: {
  if ($did(15).text) did -e wm 14
  if (!$did(15).text) did -b wm 14
  if ($chr(32) isin $did(15)) {
    did -b wm 14
    noop $input(Windows can not have spaces in them. Please try again.,ao,ERROR)
  }
}
on *:dialog:wm:sclick:17: {
  close $did(16).seltext
  updatewindows
}
on *:dialog:wm:sclick:16: {
  if ($did(16).seltext) did -e wm 17,18
}
on *:dialog:wm:sclick:18: {
  aline -p $did(16) $input(Please enter your message,aoe,Message $did(16))
  noop $input(Your line has been added,ao,Added Line)
}
menu * {
  Window Manager:/dialog -m wm wm
}

Comments

Sign in to comment.
Battlemonkey   -  Jan 30, 2010

Ok, I see the problem. I'll fix it soon.

 Respond  
CadetAndrew   -  Jan 29, 2010

Using this one and getting lots of errors.

I tried messaging myself for test purposes, and I got:

  • /msg: insufficient parameters (line 119, windowmanager)
  • /msg: insufficient parameters (line 119, windowmanager)
  • /msg: insufficient parameters (line 119, windowmanager)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.