#Homepage1 on
on *:START:/run http://www.bandyscript.de
#Homepage1 end

#Homepage2 on
on *:CONNECT:{ if ( $time(HH) >= %radiotime ) { run %radiostreamurl } }
#Homepage2 end

#Homepage3 on
on *:DISCONNECT:/run http://www.radiosunlight.de
#Homepage3 end

#Nickangesprochen on
on *:TEXT:$(* $+ $me $+ *):*:{
  if ($active != $target) {
    echo -a  $+ %sysfarben5 $+ [ $+ %sysfarben6 $+ Nachricht $+ %sysfarben5 $+ ] $+ %sysfarben6 $nick  $+ %sysfarben5 $+ hat Dich angesprochen in $+ %sysfarben6 $iif($chr(35) isin $target,$chan,private) $+  $+ %sysfarben5 $+ ,  $+ %sysfarben2 $+ um $time  $+ %sysfarben5 $+ mit dem Text: $1-
  }
}
#Nickangesprochen end

#rueckwaertsschreiben off
on *:input:*:{ 
  if (/* !iswm $1- ) {
    var %rückwärts.text $1-
    var %rückwärts.text.länge $len(%rückwärts.text)
    goto rückwärts
    :rückwärts
    if (%rückwärts.text.länge = 0) { say $replace(%rückwärts.text.test,---,$chr(32)) | unset %rückwärts.text* | halt }
    if (%rückwärts.text.länge > 0) {
      set %rückwärts.text.test %rückwärts.text.test $+ $chr($asc($mid(%rückwärts.text,%rückwärts.text.länge,1)))
      if ($asc($mid(%rückwärts.text,%rückwärts.text.länge,1)) == 32) { set %rückwärts.text.test %rückwärts.text.test $+ --- }
      inc %rückwärts.text.länge -1
      goto rückwärts
    }
  }
}
#rueckwaertsschreiben end
on ^1:text:!peng*:#:{
  /kick # $nick Hier wird nicht geschossen :P
}
#bombenspiel on
alias bombreset { 
  /unset %bombstat* 
  /unset %bombchan* 
  /set %bombtop 0 
  /set %bombtopn 0
  /.timerbombreset off
  /.timerbombreset 00:01 1 1 /bombreset
}

on *:text:!bombkick:#:{
  if ( $me isop $chan ) { /bombkick $nick }
}

on 1:text:!bombstats:#:{
  if ( %bombstats [ $+ [ $$1 ] ]  = on ) { /halt }
  /set -u20 %bomstats [ $+ [ $$1 ] ] on
  /.notice $nick 8,1Du hast $iif(%bombstat [ $+ [ $nick ] ] != $null,%bombstat [ $+ [ $nick ] ],0) Bomben erfolgreich hintereinander entschärft ;)
}

alias bombkick {
  if ( %bombtop = $null ) { /set %bombtop 0 }
  if ( %bombtopn = $null ) { /set %bombtopn 0 }
  if ( %bombkick [ $+ [ $$1 ] ]  = on ) { /halt }
  elseif ( %bombchan [ $+ [ $nick ] ] != $null ) { 
    if ( %bombchanb [ $+ [ $nick ] ] = blubb ) { halt }
    /.notice $nick 12,1Nur eine Bombe alle 3 Minuten ! ;)
    halt
  }
  /set -u20 %bombkick [ $+ [ $$1 ] ] on
  /inc %bombnumber
  /describe $chan 0,1gibt $$1 ne Bombe in die Hand ! Versuch das richtige Kabel durchzuschneiden mit 4,1!rot0,1, 8,1!gelb 0,1oder 9,1!grün 0,1!!! schnell, du hast nur 20 sekunden!! (Bombe Nr. %bombnumber $+ )
  /.timerbombkick $+ $$1 1 20 /kick $chan $$1 11,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn
  /set %farbe $rand(1,3)
  if (%farbe == 1) { set %farb rot }
  if (%farbe == 2) { set %farb grün }
  if (%farbe == 3) { set %farb gelb }
  /set -u20 %bombcolor [ $+ [ $$1 ] ] %farb
  /set -u180 %bombchan [ $+ [ $$1 ] ] $chan
}

on 1:text:!rot:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = rot ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 4,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 4,1ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 4,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 4,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /kick %bombchan [ $+ [ $nick ] ] $nick 4,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 4,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Explosionen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 4,1ist neuer Meister-Explodierer mit %bombtopn Explosionen !!! }
    }
  }
}

on 1:text:!grün:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = grün ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 9,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 9,1ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 9,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 9,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /kick %bombchan [ $+ [ $nick ] ] $nick 9,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 9,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Entschärfungen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 9,1ist neuer Meister-Explodierer mit %bombtopn Explosioenen !!! }
    }
  }
}

on 1:text:!gelb:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = gelb ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 8,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 8,1 ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 8,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 8,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /kick %bombchan [ $+ [ $nick ] ] $nick 8,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 8,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Entschärfungen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 8,1ist neuer Meister-Explodierer mit %bombtopn Explosioenen !!! }
    }
  }
}

on *:text:!bombban:#:{
  if ( $me isop $chan ) /bombban $nick
}

alias bombban {
  if ( %bombtop = $null ) { /set %bombtop 0 }
  if ( %bombtopn = $null ) { /set %bombtopn 0 }
  if ( %bombkick [ $+ [ $$1 ] ]  = on ) { /halt }
  elseif ( %bombchan [ $+ [ $nick ] ] != $null ) { 
    if ( %bombchanb [ $+ [ $nick ] ] = blubb ) { halt }
    /.notice $nick 12,1Nur eine Bombe alle 3 Minuten ! ;)
    halt
  }
  /set -u20 %bombkick [ $+ [ $$1 ] ] on
  /inc %bombnumber
  /describe $chan 0,1gibt $$1 eine Bombe in die Hand ! Versuch das richtige Kabel durchzuschneiden mit 12,1!blau0,1, 14,1!grau 0,1oder 13,1!rosa 0,1!!! schnell, du hast nur 20 sekunden!! (Bombe Nr. %bombnumber $+ )
  /.timerbombkick $+ $$1 1 20 /ban -u60 $chan $$1 | /.timerbombban $+ $$1 1 25 /kick $chan $$1 11,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn
  /set %farbe $rand(1,3)
  if (%farbe == 4) { set %farb blau }
  if (%farbe == 5) { set %farb grau }
  if (%farbe == 6) { set %farb rosa }
  /set -u20 %bombcolor [ $+ [ $$1 ] ] %farb
  /set -u180 %bombchan [ $+ [ $$1 ] ] $chan
}

on 1:text:!blau:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = blau ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 4,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 4,1ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 4,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 4,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /.timerbombban $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /ban -u60 %bombchan [ $+ [ $nick ] ] $nick
      /kick %bombchan [ $+ [ $nick ] ] $nick 4,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 4,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Explosionen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 4,1ist neuer Meister-Explodierer mit %bombtopn Explosionen !!! }
    }
  }
}

on 1:text:!grau:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = grau ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 8,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /.timerbombban $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 8,1ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 8,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 8,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /.timerbombban $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /ban -u60 %bombchan [ $+ [ $nick ] ] $nick
      /kick %bombchan [ $+ [ $nick ] ] $nick 8,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 8,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Entschärfungen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 8,1ist neuer Meister-Explodierer mit %bombtopn Explosioenen !!! }
    }
  }
}

on 1:text:!rosa:#:{
  if ( %bombkick [ $+ [ $nick ] ]  = on ) {
    if ( %bombcolor [ $+ [ $nick ] ] = rosa ) {
      /inc %bombstat [ $+ [ $nick ] ]
      /unset %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] 9,1puh, da haste nochmal glück gehabt $nick ! Bombe entschärft. - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstat [ $+ [ $nick ] ]
      /.timerbombkick $+ $nick off
      /.timerbombban $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      if ( %bombtop = %bombstat [ $+ [ $nick ] ] ) { msg $chan $nick 9,1 ist jetzt mit an der Bomb-kick-spitze! ( $+ %bombtop Entschärfungen, genau wie: %bombtopnick $+ ) | /set %bombtopnick $addtok(%bombtopnick,$nick,32) }
      if ( %bombtop < %bombstat [ $+ [ $nick ] ] ) { /set %bombtop %bombstat [ $+ [ $nick ] ] | /set %bombtopnick $nick | msg $chan $nick 9,1ist neuer Meister-Entschärfer mit %bombtop Entschärfungen !!! }
    }
    else {
      /inc %bombstatn [ $+ [ $nick ] ]
      /describe %bombchan [ $+ [ $nick ] ] meint: 9,1falscher Draht $nick - *BOOOOOOOOOM*
      /.timerbombkick $+ $nick off
      /.timerbombban $+ $nick off
      /unset %bombkick [ $+ [ $nick ] ]
      /ban -u60 %bombchan [ $+ [ $nick ] ] $nick
      /kick %bombchan [ $+ [ $nick ] ] $nick 9,1*BOOOM* - die Bombe ist hochgegangen ;) - Top: %bombtopnick - %bombtop -- Flop: %bombtopnickn - %bombtopn -- Du: %bombstatn [ $+ [ $nick ] ]
      /unset %bombstat [ $+ [ $nick ] ]
      if ( %bombtopn = %bombstatn [ $+ [ $nick ] ] ) { msg $chan $nick 9,1ist jetzt auch mit ganz unten! ( $+ %bombtopn Entschärfungen, genau wie: %bombtopnickn $+ ) | /set %bombtopnickn $addtok(%bombtopnickn,$nick,32) }
      if ( %bombtopn < %bombstatn [ $+ [ $nick ] ] ) { /set %bombtopn %bombstatn [ $+ [ $nick ] ] | /set %bombtopnickn $nick | msg $chan $nick 9,1ist neuer Meister-Explodierer mit %bombtopn Explosioenen !!! }
    }
  }
}
#bombenspiel end

on 1:INPUT:* {
  if ((/* !iswm $1) || ($ctrlenter)) {
    if ( %colorset == ON ) { goto start }
    if ( %colorset == OFF ) { goto end }
    :start
    if ( $1 ) { say $chr(3) $+ %tcolor $+ $1- | halt }
    :end
  }
}

on *:dialog:color:sclick:*: {
  if ($did == 4).state { set %colorset ON }
  elseif ($did(4).state == 0) { set %colorset OFF | unset %tcolor }
  set %tcolor $did(color,48).text
  elseif ($did(4).state == 0) { set %colorset OFF | unset %tcolor }
  if ($did == 45) echo -a $chr(3) $+ %tcolor $+  $+ $1- Farb - TEST
}
on *:dialog:color:init:*: {
  if %colorset == ON { did -c $dname 4 }
  did -a color 48 %tcolor
}
dialog color {
  title Farbtext - %bsver
  size -1 -1 102 111
  option dbu
  icon Bandy.ico, 0
  button "Schließen", 19, 60 94 37 12, ok
  text "Acros müssen vorher", 49, 4 74 60 10
  text "ausgeschaltet werden!", 50, 4 84 60 10
  box "Farbcode :", 21, 4 3 94 34
  box "Textfarbe :", 41, 4 40 94 34
  button "Test", 45, 63 60 25 10
  check "Textfarbe AN", 4, 9 48 43 10
  icon 47, 8 11 86 22, $mircdirpics\colors.png, 0, noborder
  edit "", 48, 38 60 13 10, limit 2 right
}

alias startVote {
  dialog -c VoteCast
  set %vc.open 1
  .rlevel -r vote1,vote2,vote3,vote4
  .timer 1 1 vc.Msg 7Voting wurde 1gestartet. 7Frage:1 %vc.question 7 $+ %vc.duration 1sek zum Vote.
  .timer 1 2 vc.Msg 7Vote so: 1!vote 7Zahl 1z.B.: !vote 1
  set %vc.m 0
  while ( %vc.m < $numtok(%vc.options,5) ) {
    inc %vc.m
    .timer 1 $calc(%vc.m + 2) vc.Msg 7 $+ %vc.m 1für7 $gettok(%vc.options,%vc.m,5)
  }
  .timerEndVote 1 %vc.duration endVote
}

alias endVote {
  set %vc.open 0
  set %vc.x 0
  unset %vc.results
  while ( %vc.x < $numtok(%vc.options,5) ) {
    inc %vc.x
    set %vc.results %vc.results $+ $ulist(*,vote $+ %vc.x,0) $+ $chr(5) 
  }
  .timer 1 1 vc.Msg 7Voting wurde 1beendet. 7Frage:1 %vc.question
  set %vc.m 0
  while ( %vc.m < $numtok(%vc.results,5) ) {
    inc %vc.m
    .timer 1 $calc(%vc.m + 2) vc.Msg 7 $+ $gettok(%vc.options,%vc.m,5) 1-7 $gettok(%vc.results,%vc.m,5) 1votes.
    set %vc.cmd $gettok(%vc.results,%vc.m,5) $+ $chr(6) $+ $gettok(%vc.commands,%vc.m,5) $+ $chr(5)
  }
  set %vc.cmd $sorttok(%vc.cmd,5,nr)
  set %vc.cmd $gettok($gettok(%vc.cmd,1,5),2,6)
  .timer 1 5 %vc.cmd
}

alias vc.Msg {
  set %vc.c 0
  while ( %vc.c < $numtok(%vc.channels,5) ) {
    inc %vc.c
    msg $gettok(%vc.channels,%vc.c,5) $1-
  }
}

on *:TEXT:!vote*:*:{
  if ( (%vc.open == 1) && ($int($left($2,1)) <= $numtok(%vc.options,5)) && ($left($2,1) isnum) ) {
    .ruser $address($nick,3)
    .auser vote $+ $left($2,1) $address($nick,3)
    .notice $nick 2You voted5 $left($2,1) $+ 2:6 $gettok(%vc.options,$left($2,1),5)
  }
}

dialog VoteCast {
  title Voting - %bsver
  size -1 -1 200 100
  option dbu

  text "Vorhandene Räume",1,11 7 50 8
  list 100,5 15 50 40
  button "Neu",502,57 34 14 10

  text "Form des Vote",2,15 48 40 8
  list 101,5 56 50 30
  button "Löschen",503,57 68 14 10

  text "Dauer",3,6 84 25 8
  edit "",200,28 82 14 11
  text "s",4,43 84 5 8

  text "Frage",5,83 8 25 8
  edit "",201,106 6 88 11,autohs

  text "Option",6,83 24 25 8
  combo 102,82 32 40 50,autohs
  button "+",505,124 33 8 8
  button "-",506,132 33 8 8

  text "Befehle",7,142 34 70 8
  edit "",202,124 42 70 10,autohs
  edit "",203,124 51 70 10,autohs
  edit "",204,124 60 70 10,autohs
  edit "",205,124 68 70 10,autohs

  box "",300,76 7 1 86

  button "Hilfe",507,118 85 25 12
  button "Vote",504,145 85 25 12
  button "Abbruch",501,172 85 25 12,ok
}

on *:DIALOG:VoteCast:sclick:504:{
  set %vc.question $did(201)
  set %vc.options $didtok(VoteCast,102,5)
  set %vc.commands $iif($did(202).text != $null,$did(202).text,beep) $+ $chr(5) $+ $iif($did(203).text != $null,$did(202).text,beep) $+ $chr(5) $+ $iif($did(202).text != $null,$did(204).text,beep) $+ $chr(5) $+ $iif($did(202).text != $null,$did(205).text,beep) $+ $chr(5)
  set %vc.channels $didtok(VoteCast,101,5)
  set %vc.duration $did(200).text

  if ( %vc.duration < 10 || %vc.duration == $null ) { 
    set %nothing $input(Du musst eine Dauer über 10 Sekunden eintragen.,260,Error)
    return
  }
  if ( $len(%vc.channels) < 2 || %vc.channels == $null ) { 
    set %nothing $input(Du musst erst ein Raum eintragen.,260,Error)
    return
  }
  if ( $numtok(%vc.options,5) < 2 ) { 
    set %nothing $input(Du musst ein paar Optionen erstellen.,260,Error)
    return
  }
  if ( %vc.question == $null ) { 
    set %nothing $input(Du musst eine Frage stellen.,260,Error)
    return
  }
  startVote
}

dialog VoteHelp {
  title Voting Hilfe - %bsver
  size -1 -1 210 148
  option dbu
  edit "Um diese Hilfe anzuzeigen benötigst Du die Datei VC-readme.txt im Hauptverzeichnis vom Script.",310,5 7 204 120,multi vsbar
  button "OK",501,182 131 25 12,ok
}

on *:DIALOG:VoteCast:sclick:507:{
  dialog -m VoteHelp VoteHelp
}

on *:DIALOG:VoteCast:sclick:505:{
  if ( $did(102).text != $null ) {
    if ( $did(102).lines < 4 ) {
      did -a VoteCast 102 $did(102).text
    }
    else { set %nothing $input(Maximum 4 Options.,260,Error) }
  }
  else { set %nothing $input(Enter some text to add.,260,Error) }
}

on *:DIALOG:VoteCast:sclick:506:{
  did -d VoteCast 102 $did(102).sel
}

on *:DIALOG:VoteCast:sclick:502:{
  if ( $did(100).sel >= 1 ) { 
    if ( $did(101).lines < 3 ) {
      did -a VoteCast 101 $did(100).seltext
      did -d VoteCast 100 $did(100).sel
    }
    else { set %nothing $input(Du kannst den Vote in nur 3 Räumen starten - Sonst droht Excess flood.,260,Error)
    }
  }
  else { set %nothing $input(Zum hinzufügen ein Channel auswählen.,260,Error) }
}

on *:DIALOG:VoteCast:sclick:503:{
  if ( $did(101).sel > 0 && $did(101).sel != $null ) {
    did -a VoteCast 100 $did(101).seltext
    did -d VoteCast 101 $did(101).sel
  }
}

on *:DIALOG:VoteCast:init:0:{
  set %cc 0
  while ( %cc < $chan(0) ) {
    inc %cc
    did -a VoteCast 100 $chan(%cc)
  }
}

on *:DIALOG:VoteHelp:init:0:{
  set %hlpCounter 0
  if ( $lines(VC-readme.txt) > 2 ) { did -r VoteHelp 310 }
  while ( %hlpCounter < $lines(VC-readme.txt) ) {
    inc %hlpCounter
    did -i VoteHelp 310 %hlpCounter $read(VC-readme.txt,l,%hlpcounter)
  }
  did -m VoteHelp 310
}

dialog multiserv {
  title MultiServer - %bsver
  icon "Bandy.ico"
  size -1 -1 324 151
  option dbu
  box " MultiServ - Dialog:  ( Server und Nicks ) ", 3, 4 2 316 131
  text "AutoConnect", 5, 9 12 33 8
  edit "", 13, 43 21 48 10, autohs limit 20
  edit "", 14, 43 33 48 10, autohs limit 20
  edit "", 15, 43 45 48 10, autohs limit 20
  edit "", 16, 43 57 48 10, autohs limit 20
  edit "", 17, 43 69 48 10, autohs limit 20
  edit "", 18, 43 81 48 10, autohs limit 20
  edit "", 19, 43 93 48 10, autohs limit 20
  edit "", 20, 43 105 48 10, autohs limit 20
  edit "", 21, 43 117 48 10, autohs limit 20
  edit "", 23, 94 21 80 10, autohs
  edit "", 24, 178 21 105 10, autohs
  button "Schließen", 26, 283 137 37 12, ok
  text " Bezeichnung:", 28, 49 12 35 8
  text "<Server> <Port> <Passwort>", 29, 97 12 103 8
  text "<Nick> <Alternativ-Nick> <RealName> <Email>", 30, 179 12 103 8
  edit "", 35, 94 33 80 10, autohs
  edit "", 36, 94 45 80 10, autohs
  edit "", 37, 94 57 80 10, autohs
  edit "", 38, 94 69 80 10, autohs
  edit "", 39, 94 81 80 10, autohs
  edit "", 40, 94 93 80 10, autohs
  edit "", 41, 94 105 80 10, autohs
  edit "", 42, 94 117 80 10, autohs
  edit "", 51, 178 33 105 10, autohs
  edit "", 52, 178 45 105 10, autohs
  edit "", 53, 178 57 105 10, autohs
  edit "", 54, 178 69 105 10, autohs
  edit "", 55, 178 81 105 10, autohs
  edit "", 56, 178 93 105 10, autohs
  edit "", 57, 178 105 105 10, autohs
  edit "", 58, 178 117 105 10, autohs
  button "Speichern", 76, 287 22 28 8
  button "Speichern", 77, 287 34 28 8
  button "Speichern", 78, 287 46 28 8
  button "Speichern", 79, 287 58 28 8
  button "Speichern", 80, 287 70 28 8
  button "Speichern", 81, 287 82 28 8
  button "Speichern", 82, 287 94 28 8
  button "Speichern", 83, 287 106 28 8
  button "Speichern", 84, 287 118 28 8
  check "Server 1:", 85, 9 22 32 8
  check "Server 2:", 86, 9 34 32 8
  check "Server 3:", 87, 9 46 32 8
  check "Server 4:", 88, 9 58 32 8
  check "Server 5:", 89, 9 70 32 8
  check "Server 6:", 90, 9 82 32 8
  check "Server 7:", 91, 9 94 32 8
  check "Server 8:", 92, 9 106 32 8
  check "Server 9:", 93, 9 117 32 8
  text "Automatisches verbinden beim Öffnen vom bIRC-Script - Server eintragen z.b. irc.radiosunlight.net 6667", 94, 8 138 253 8, disable
}
dialog systemfarben {
  title System Farben - %bsver
  size -1 -1 200 280
  icon 15, 5 200 190 80,  pics\colors.png, 0, noborder center
  text "Farbtabelle", 16, 5 195 170 20, center
  edit "", 1, 5 5 35 20,autohs
  edit "", 2, 5 30 35 20,autohs
  edit "", 3, 5 55 35 20,autohs
  edit "", 4, 5 80 35 20,autohs
  edit "", 5, 5 105 35 20,autohs
  edit "", 6, 5 130 35 20,autohs
  text "Raw Farbe 1", 7, 50 5 70 20 
  text "Raw Farbe 2", 8, 50 30 70 20
  text "Aliases Farbe 1", 9, 50 55 90 20
  text "Aliases Farbe 2", 10, 50 80 90 20
  text "PopUp Farbe 1", 11, 50 105 80 20
  text "PopUp Farbe 2", 12, 50 130 80 20
  button "OK",13, 5 165 50 20,OK
  button "Abbruch",14, 60 165 50 20,Cancel
}
on *:DIALOG:systemfarben:init:0:{
  did -a systemfarben 1 %sysfarben1
  did -a systemfarben 2 %sysfarben2
  did -a systemfarben 3 %sysfarben3
  did -a systemfarben 4 %sysfarben4
  did -a systemfarben 5 %sysfarben5
  did -a systemfarben 6 %sysfarben6
}
On *:DIALOG:systemfarben:sclick:13:{
  set %sysfarben1 $did(systemfarben,1).text
  set %sysfarben2 $did(systemfarben,2).text
  set %sysfarben3 $did(systemfarben,3).text
  set %sysfarben4 $did(systemfarben,4).text
  set %sysfarben5 $did(systemfarben,5).text
  set %sysfarben6 $did(systemfarben,6).text
}

on *:start:{
  set %bandwidth 0.00
  set %bandwidth-data $dll(dll\bandwidth.dll,combined,null)
  .timer.bandwidth -o 0 1 bandwidth
  dll $mircdirdll\tbtray.dll OpenTray NOT_USED
  dll $mircdirdll\tbtray.dll SetWidth 90
  dll $mircdirdll\tbtray.dll SetText %bandwidth $+ Kb/s
}
alias bandwidth {
  if ( %moni == $null ) { dll $mircdirdll\tbtray.dll SetText TL: $+ %bandwidth $+ Kb/s | halt }
  if ( %moni == 1 ) { dll $mircdirdll\tbtray.dll SetText Lag: %lag.say | halt }
  if ( %moni == 2 ) { dll $mircdirdll\tbtray.dll SetText DL: $+ %downstream $+ KB/s | halt }
  if ( %moni == 3 ) { dll $mircdirdll\tbtray.dll SetText UP: $+ %upstream $+ KB/s | halt }
}
alias bw.stop {
  unset %moni 1
  dll $mircdirdll\tbtray.dll CloseTray NOT_USED
  .timer.bandwidth off
  .timerlagmeter off
  set %lag.say --
}
alias bw.start {
  dll $mircdirdll\tbtray.dll OpenTray NOT_USED
  .timer.bandwidth -o 0 1 bandwidth
  dll $mircdirdll\tbtray.dll SetWidth 90
  dll $mircdirdll\tbtray.dll SetText %bandwidth $+ Kb/s
  set %moni 2
}

alias _G-Responder {
  if ($dialog(_G-Res_v2)) { dialog -v _G-Res_v2 _G-Res_v2 }
  else { dialog -m _G-Res_v2 _G-Res_v2 }
}

on *:CONNECT:{
  if (!$hget(_G-Responder)) { hmake _G-Responder 100 }
  if ($exists($scriptdiroptions.dat)) { hload _G-Responder $scriptdiroptions.dat }
  if (!$hget(_G-RES)) { hmake _G-RES 100 }
  if ($exists($scriptdiritems.dat)) { hload _G-RES $scriptdiritems.dat }
}
on *:EXIT:{
  if ($hget(_G-RES)) { hsave -o _G-RES $scriptdiritems.dat }
  if ($hget(_G-Responder)) { hsave -o _G-Responder $scriptdiroptions.dat }
}
alias _G-Res_re {
  if ($hget(_G-Res_temp)) { hfree _G-Res_temp }
  hmake _G-Res_temp 13
  var %re = $1-, %nt = 1, %ec = 0
  while ($pos(%re,$chr(44),%nt)) {
    var %ps = $pos(%re,$chr(44),%nt)
    if (%ps == 1) { %re = $right(%re,-1) }
    elseif (%ps == $len(%re)) && ($mid(%re,$calc($len(%re) - 1),1) != \) { %re = $left(%re,-1) }
    else {
      if ($mid(%re,$calc(%ps - 1),1) != \) {
        inc %ec
        hadd _G-Res_temp %ec $replace($left(%re,$calc(%ps - 1)),$+(\,$chr(44)),$chr(44))
        %re = $right(%re,$+(-,%ps))
        if (%nt != 1) { %nt = 1 }
      }
      else { inc %nt }
    }
  }
  if (%re != $null) { inc %ec | hadd _G-Res_temp %ec $replace(%re,$+(\,$chr(44)),$chr(44)) }
  if ($hget(_G-Res_temp,13) != $null) { return 1 }
  return 0
}
alias _G-Res_error {
  if ($dialog(_G-Res_v2_error)) { dialog -v _G-Res_v2_error }
  else { dialog -m _G-Res_v2_error _G-Res_v2_error }
  did -ca _G-Res_v2_error 1 $1-
}
alias _G-Res_add {
  var %i = 1
  while (%i) {
    %rnd = $r(a,z) $+ $ticks $+ %i
    if ($hget(_G-RES,%rnd)) { inc %i }
    else {
      hadd -m _G-RES $iif($1 == new,%rnd,$1) $2-
      %_G-Res_GLOBAL = %rnd
      break
    }
  }
}

alias _G-Res_event {
  var %cg = $hget(_G-Responder,fm)
  var %rl = $hget(_G-RES,0).item
  while (%rl) {
    if ($_G-Res_re($hget(_G-RES,%rl).data)) {
      if ($2 ischan) {
        if ($hget(_G-Res_temp,4) == all) || (($token($hget(_G-Res_temp,4),1,58) == ae) && (!$istok($hget(_G-Res_temp,4),$chan,32))) || (($token($hget(_G-Res_temp,4),1,58) == o) && ($istok($hget(_G-Res_temp,4),$chan,32))) {
          if ($hget(_G-Res_temp,5)) || ($hget(_G-Res_temp,6)) || ($hget(_G-Res_temp,7)) {
            var %ct = $hget(_G-Res_temp,1)
            if ($hget(_G-Res_temp,12) isnum 1-) { var %ct = $eval(%ct,$calc($hget(_G-Res_temp,12) + 1)) }
            if ($hget(_G-Res_temp,8)) {
              if ($regex($3-,%ct)) { var %yr = 1 }
            }
            elseif (%ct iswm $3-) { var %yr = 1 }
            if (%yr) {
              unset %yr
              if (!$hget(_G-Responder,$+(temp,$cid,$hget(_G-RES,%rl).item,$2,$nick))) {
                if ($hget(_G-Res_temp,3)) {
                  hadd -mu [ $+ [ $iif($hget(_G-Res_temp,3) isnum && $hget(_G-Res_temp,3) > 0,$hget(_G-Res_temp,3),20) ] ] _G-Responder $+(temp,$cid,$hget(_G-RES,%rl).item,$2,$nick) 1
                }
                if ($1 == 1) { var %sc = describe }
                elseif ($1 == 2) { var %sc = notice }
                else { var %sc = msg }
                %sc $2 $iif($hget(_G-Res_temp,13) isnum 1-,$eval($hget(_G-Res_temp,2),$calc($hget(_G-Res_temp,13) + 1)),$hget(_G-Res_temp,2))
                if (%cg) { break }
              }
            }
          }
        }
      }
      else {
        if ($hget(_G-Res_temp,9)) || ($hget(_G-Res_temp,10)) || ($hget(_G-Res_temp,11)) {
          var %ct = $hget(_G-Res_temp,1)
          if ($hget(_G-Res_temp,12) isnum 1-) { var %ct = $eval(%ct,$calc($hget(_G-Res_temp,12) + 1)) }
          if ($hget(_G-Res_temp,8)) {
            if ($regex($3-,%ct)) { var %yr = 1 }
          }
          elseif (%ct iswm $3-) { var %yr = 1 }
          if (%yr) {
            unset %yr
            if (!$hget(_G-Responder,$+(temp,$cid,$hget(_G-RES,%rl).item,$nick))) {
              if ($hget(_G-Res_temp,3)) {
                hadd -mu [ $+ [ $iif($hget(_G-Res_temp,3) isnum && $hget(_G-Res_temp,3) > 0,$hget(_G-Res_temp,3),20) ] ] _G-Responder $+(temp,$cid,$hget(_G-RES,%rl).item,$nick) 1
              }
              if ($1 == 1) { var %sc = describe }
              elseif ($1 == 2) { var %sc = .notice }
              else { var %sc = msg }
              %sc $nick $iif($hget(_G-Res_temp,13) isnum 1-,$eval($hget(_G-Res_temp,2),$calc($hget(_G-Res_temp,13) + 1)),$hget(_G-Res_temp,2))
              if (%cg) { break }
            }
          }
        }
      }
    }
    dec %rl
  }
}
dialog _G-Res_v2 {
  title Autobeantworter - %bsver
  option dbu
  size -1 -1 250 200
  box "Information:",1,10 10 230 25
  text "Wildcard = Einzelwort reagieren. REGEX = Reagieren wenn Wort im Satz vorkommt.",2,15 20 225 10
  box "Optionen:",3,10 40 230 35
  check "Auf Gross- und Kleinschrift achten",4,15 50 160 10
  check "Fehlerhafte Einträge prüfen und löschen",5,15 60 203 10
  box "Einstellung:",6,10 80 230 90
  list 7,15 90 220 60,extsel,size
  button "&Neu",8,145 153 30 12
  button "&Editieren",9,175 153 30 12
  button "&Löschen",10,205 153 30 12
  button "&Hilfe",11,75 178 30 12
  button "&OK",12,110 178 30 12,ok
  button "&Abbruch",13,145 178 30 12,cancel
  button "&Refresh",14,20 153 30 12
  button "An",15,10 178 30 12
  button "Aus",16,40 178 30 12
}
on *:dialog:_G-Res_v2:sclick:15: { enable #beantworter | echo -a  $+ %sysfarben5 $+ »»»  $+ %sysfarben6 $+ Autobeantworter ist nun AN }
on *:dialog:_G-Res_v2:sclick:16: { disable #beantworter | echo -a  $+ %sysfarben5 $+ »»»  $+ %sysfarben6 $+ Autobeantworter ist nun AUS }

dialog _G-Res_v2_add {
  title Neues Wort - %bsver
  option dbu
  size -1 -1 250 135
  combo 1,0 0 10 10,edit,hide,hsbar
  text "Welches Wort:",2,10 10 45 10
  combo 3,57 8 103 10,edit
  radio "Wildcard",4,170 9 31 10
  radio "REGEX",5,212 9 28 10
  text "Text:",6,40 24 15 10
  combo 7,57 22 183 10,edit
  text "Prüfzeit für Wiedergabetext",8,10 38 73 10
  edit "",9,85 36 12 10
  text "Zeit bis zur Antwort",10,99 38 47 10
  edit "",11,148 36 12 10
  text "Sek. (0 keine Auswertung)",12,162 38 68 10
  box "Antwort:",13,10 49 230 50
  check "Private Action",14,15 59 50 10
  check "Private Nachricht",15,95 59 56 10
  check "Private Notice",16,175 59 50 10
  check "Channel Action",17,15 69 53 10
  check "Channel Nachricht",18,95 69 59 10
  check "Channel Notice",19,175 69 53 10
  text "Aktive Channels:",20,15 83 56 10
  combo 21,73 81 50 40,drop
  combo 22,125 81 105 10,edit
  text "Wieder reagieren nach:",23,10 107 59 10
  edit "",24,71 105 12 10
  text "Sekunden - (0 = immer)",25,85 107 86 10
  button "&Neu",26,175 118 30 12
  button "&Abbruch",27,210 118 30 12,cancel
}
dialog _G-Res_v2_error {
  title Fehler - %bsver
  option dbu
  size -1 -1 100 70
  text "",1,10 10 80 28
  button "OK",2,35 48 30 12,cancel
}
on *:DIALOG:_G-Res_*:*:*:{
  if ($dname == _G-Res_v2) {
    if ($devent == init) && ($did == 0) {
      dll $mircdirdll\mdx.dll SetMircVersion $version
      dll $mircdirdll\mdx.dll MarkDialog $dname
      dll $mircdirdll\mdx.dll SetControlMDX $dname 7 listview report showsel single > $mircdirdll\views.mdx
      did -i $dname 7 1 headerdims 50:1 150:2 100:3 200:4 200:5 200:6 150:7
      did -i $dname 7 1 headertext ID $+ $chr(9) $+ +c Text to respond to (type) $+ $chr(9) $+ +c Reply $+ $chr(9) $+ +c Reply in chans (action,msg,notice) $+ $chr(9) $+ +c Chans to respond in $+ $chr(9) $+ +c Reply in privates (action,msg,notice) $+ $chr(9) $+ +r Ignore time after replying
      if ($hget(_G-Responder,fm)) { did -c $dname 4 }
      if ($hget(_G-Responder,onstart)) { did -c $dname 5 }
      var %itmz = $hget(_G-RES,0).item
      while (%itmz) {
        if ($_G-Res_re($hget(_G-RES,%itmz).data)) {
          if ($token($hget(_G-Res_temp,4),1,58) == o) { var %chz = Only $iif($token($hget(_G-Res_temp,4),2,58),$token($hget(_G-Res_temp,4),2,58),[not defined]) }
          elseif ($token($hget(_G-Res_temp,4),1,58) == ae) { var %chz = All except $iif($token($hget(_G-Res_temp,4),2,58),$token($hget(_G-Res_temp,4),2,58),[not defined]) }
          else { var %chz = All }
          did -a $dname 7 +l 0 0 0 $hget(_G-RES,%itmz).item $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,1) ( $+ $iif($hget(_G-Res_temp,8),REGEX,Wildcard) - Evaluation: $hget(_G-Res_temp,12) time(s)) $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,2) (Evaluation: $hget(_G-Res_temp,13) time(s)) $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,7),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,6),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,5),Yes,No) $+ ) $+ $chr(9) $+ %chz $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,11),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,10),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,9),Yes,No) $+ ) $+ $chr(9) $+ $chr(91) $+ $iif($hget(_G-Res_temp,3),$hget(_G-Res_temp,3) second(s),No ignore) $+ $chr(93)
        }
        dec %itmz
      }
    }
    elseif ($devent == sclick) && ($did == 8) {
      if ($dialog(_G-Res_v2_add)) { dialog -v _G-Res_v2_add }
      else { dialog -m _G-Res_v2_add _G-Res_v2_add }
    }
    elseif ($devent == sclick) && ($did == 9) {
      if ($did(7).seltext) {
        if ($dialog(_G-Res_v2_add)) {
          _G-Res_error Error: Dieses Wort ist bereits in Verwendung...
        }
        else {
          var %idn = $token($token($did(7).seltext,1,9),$numtok($token($did(7).seltext,1,9),32),32)
          if ($_G-Res_re($hget(_G-RES,%idn))) {
            dialog -m _G-Res_v2_add _G-Res_v2_add
            dialog -t _G-Res_v2_add Autobeantworter - Bearbeitungstool %idn
            did -ca _G-Res_v2_add 1 %idn
            did -ca _G-Res_v2_add 3 $hget(_G-Res_temp,1)
            did -c _G-Res_v2_add $iif($hget(_G-Res_temp,8),5,4)
            did -ca _G-Res_v2_add 7 $hget(_G-Res_temp,2)
            did -a _G-Res_v2_add 9 $hget(_G-Res_temp,12)
            did -a _G-Res_v2_add 11 $hget(_G-Res_temp,13)
            if ($hget(_G-Res_temp,11)) { did -c _G-Res_v2_add 14 }
            if ($hget(_G-Res_temp,10)) { did -c _G-Res_v2_add 15 }
            if ($hget(_G-Res_temp,9)) { did -c _G-Res_v2_add 16 }
            if ($hget(_G-Res_temp,7)) { did -c _G-Res_v2_add 17 }
            if ($hget(_G-Res_temp,6)) { did -c _G-Res_v2_add 18 }
            if ($hget(_G-Res_temp,5)) { did -c _G-Res_v2_add 19 }
            if ($token($hget(_G-Res_temp,4),1,58) == ae) { did -c _G-Res_v2_add 21 2 }
            elseif ($token($hget(_G-Res_temp,4),1,58) == o) { did -c _G-Res_v2_add 21 3 }
            if ($token($hget(_G-Res_temp,4),2,58)) { did -ca _G-Res_v2_add 22 $token($hget(_G-Res_temp,4),2,58) }
            did -a _G-Res_v2_add 24 $hget(_G-Res_temp,3)
            did -a _G-Res_v2_add 26 &Edit
          }
        }
      }
    }
    elseif ($devent == sclick) && ($did == 10) {
      var %idn = $token($token($did(7).seltext,1,9),$numtok($token($did(7).seltext,1,9),32),32)
      if ($hget(_G-RES,%idn)) {
        did -d $dname 7 $did(7).sel
        hdel _G-RES %idn
      }
    }
    elseif ($devent == sclick) && ($did == 11) {
      if ($exists($scriptdir_G-Res_help.html)) { run $scriptdir_G-Res_help.html }
      else {
        write -c $scriptdir_G-Res_help.html
        write $scriptdir_G-Res_help.html <html><head><title>Autobeantworter Hilfe wurde nicht gefunden!</title>
        write $scriptdir_G-Res_help.html </head><body><h1>HILFE NICHT GEFUNDEN</h1>
        write $scriptdir_G-Res_help.html Für weitere Informationen schaut einfach mal auf www.bandyscript.de im Forum rein (Infos werden dort folgen) <a href="http://www.bandyscript.de/">www.bandyscript.de</a>
        write $scriptdir_G-Res_help.html </body</html>
        run $scriptdir_G-Res_help.html
      }
    }
    elseif ($devent == sclick) && ($did == 12) {
      hadd -m _G-Responder fm $did(4).state
      hadd -m _G-Responder onstart $did(5).state
    }
    elseif ($devent == sclick) && ($did == 14) {
      did -r $dname 7
      var %itmz = $hget(_G-RES,0).item
      while (%itmz) {
        if ($_G-Res_re($hget(_G-RES,%itmz).data)) {
          if ($token($hget(_G-Res_temp,4),1,58) == o) { var %chz = Only $iif($token($hget(_G-Res_temp,4),2,58),$token($hget(_G-Res_temp,4),2,58),[not defined]) }
          elseif ($token($hget(_G-Res_temp,4),1,58) == ae) { var %chz = All except $iif($token($hget(_G-Res_temp,4),2,58),$token($hget(_G-Res_temp,4),2,58),[not defined]) }
          else { var %chz = All }
          did -a $dname 7 +l 0 0 0 $hget(_G-RES,%itmz).item $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,1) ( $+ $iif($hget(_G-Res_temp,8),REGEX,Wildcard) - Evaluation: $hget(_G-Res_temp,12) time(s)) $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,2) (Evaluation: $hget(_G-Res_temp,13) time(s)) $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,7),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,6),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,5),Yes,No) $+ ) $+ $chr(9) $+ %chz $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,11),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,10),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,9),Yes,No) $+ ) $+ $chr(9) $+ $chr(91) $+ $iif($hget(_G-Res_temp,3),$hget(_G-Res_temp,3) second(s),No ignore) $+ $chr(93)
        }
        dec %itmz
      }
    }
  }
  elseif ($dname == _G-Res_v2_add) {
    if ($devent == init) && ($did == 0) {
      did -c $dname 4
      did -a $dname 21 All
      did -a $dname 21 All except
      did -a $dname 21 Only
      did -c $dname 21 1
    }
    elseif ($devent == sclick) && ($did == 26) {
      if ($did(3)) {
        if ($did(7)) {
          if ($did(9) isnum 0-) && ($did(11) isnum 0-) {
            if ($did(24) isnum 0-) {
              if ($did(21).sel == 3) { var %chz = o: $did(22) }
              elseif ($did(21).sel == 2) { var %chz = ae: $did(22) }
              else { var %chz = all }
              _G-Res_add $iif($did(1),$did(1),new) $replace($did(3),$chr(44),$+(\,$chr(44))) , $replace($did(7),$chr(44),$+(\,$chr(44))) , $did(24) , %chz , $did(19).state , $did(18).state , $did(17).state , $did(5).state , $did(16).state , $did(15).state , $did(14).state , $did(9) , $did(11)
              if ($dialog(_G-Res_v2)) && (!$did(1)) && ($_G-Res_re($hget(_G-RES,%_G-Res_GLOBAL))) {
                if ($token(%chz,1,58) == o) { var %chz2 = Only $token(%chz,2-,58) }
                elseif ($token(%chz,1,58) == ae) { var %chz2 = All except $token(%chz,2-,58) }
                else { var %chz2 = All }
                did -a _G-Res_v2 7 +l 0 0 0 %_G-Res_GLOBAL $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,1) ( $+ $iif($hget(_G-Res_temp,8),REGEX,Wildcard) - Evaluation: $hget(_G-Res_temp,12) time(s)) $+ $chr(9) $+ +c 0 0 0 $hget(_G-Res_temp,2) (Evaluation: $hget(_G-Res_temp,13) time(s)) $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,7),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,6),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,5),Yes,No) $+ ) $+ $chr(9) $+ %chz2 $+ $chr(9) $+ ( $+ $iif($hget(_G-Res_temp,11),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,10),Yes,No) $+ , $+ $iif($hget(_G-Res_temp,9),Yes,No) $+ ) $+ $chr(9) $+ $chr(91) $+ $iif($hget(_G-Res_temp,3),$hget(_G-Res_temp,3) second(s),No ignore) $+ $chr(93)
              }
              unset %_G-Res_GLOBAL
              dialog -x $dname
            }
            else { _G-Res_error Fehler: Wieder reagieren muss mit 0 oder einer Zahl versehen werden, um zu wissen wann reagiert werden soll. }
          }
          else { _G-Res_error Fehler: Um auf Auswerten zu können, müssen beide Felder mit einer positiven Zahl oder 0 eingetragen werden. }
        }
        else { _G-Res_error Fehler: Du hast kein Antwortsatz eingetragen. }
      }
      else { _G-Res_error Fehler: Du hast kein Wort angegeben. }
    }
  }
}
#beantworter off
on *:ACTION:*:*:{ _G-Res_event 1 $target $1- }
on *:NOTICE:*:*:{ _G-Res_event 2 $target $1- }
on *:TEXT:*:*:{ _G-Res_event 3 $target $1- }
#beantworter end
dialog shout {
  title SC Stream Recorder - %bsver
  size -1 -1 139 152
  option dbu
  edit "", 1, 3 8 94 10
  box "Adresse", 2, 1 1 98 19
  box "Port", 3, 98 1 40 19
  edit "", 4, 100 8 36 10
  box "", 5, 1 16 137 121
  list 6, 3 21 133 41, size vsbar
  text "Output:", 7, 4 65 20 8
  edit "", 8, 24 64 91 10, read autohs
  button "[...]", 9, 116 64 19 10
  button "Ende", 10, 111 139 27 12, cancel
  box "Infos", 11, 1 76 137 61
  text "Radio Name:", 12, 5 84 31 8, right
  edit "", 13, 37 83 98 10, read autohs
  text "Radio URL:", 14, 5 95 31 8, right
  edit "", 15, 37 94 98 10, read autohs
  edit "", 17, 3 125 43 10, read
  text "Genre:", 18, 5 106 31 8, right
  edit "", 19, 37 105 98 10, read autohs
  edit "", 20, 48 125 43 10, read
  edit "", 21, 93 125 43 10, read
  box "Bitrate", 22, 1 117 47 20
  box "Record time", 23, 47 117 45 20
  box "Dateigröße", 24, 91 117 47 20
  button "Start", 25, 82 139 27 12
  button "Play", 26, 1 139 27 12, disable
}
on *:dialog:shout:init:*: {
  hmake shout 100
  hadd shout file $mircdir $+ Radio.mp3
  hadd shout head 0
  did -ra shout 8 $hget(shout,file)
}
on *:dialog:shout:sclick:26: {
  if (!$hget(shout,ispl)) { shp -p | did -ra shout 26 Stop }
  else { shp -s | did -ra shout 26 Play }
}
on *:dialog:shout:sclick:10: sockclose shoutcast | shp -s | hfree shout | .timershout off
on *:dialog:shout:sclick:9: var %a = $sfile($mircdir,Choose a file) | if (%a) { hadd shout file %a | did -ra shout 8 %a }
on *:dialog:shout:sclick:25: {
  if ($did(shout,25) == Start) {
    if ($isfile($+(",$hget(shout,file),"))) { var %a = $input(The specified file allready exist, do you want to overwrite it ?) | if (!%a) return }
    write -c $+(",$hget(shout,file),")
    var %ip = $did(shout,1), %port = $did(shout,4)
    if (!%ip) || (!%port) { var %a = $input(Enter a valid IP/Port,260) | return }
    hadd shout ip %ip | hadd shout port %port
    did -ra shout 6 Connecting to: $+($hget(shout,ip),:,$hget(shout,port)) ...
    did -ra shout 25 Stop
    sockopen shoutcast $hget(shout,ip) $hget(shout,port)
    did -e shout 26
  }
  else {
    sockclose shoutcast
    did -a shout 6 Stream stopped | did -ra shout 25 Start | did -ra shout 26 Play
    .timershout off | hadd shout head 0 | shp -s | did -b shout 26
  }
}
alias shoutcast dialog $iif($dialog(shout),-v,-m shout) shout

on *:sockopen:shoutcast: { 
  if ($sockerr) { disp Can't connect to: $+($hget(shout,ip),:,$hget(shout,port)) | return }
  var %a = sockwrite -n shoutcast
  %a GET / HTTP/1.0
  %a Host: $sock(shoutcast).ip
  %a User-Agent: mSSC/1.1
  %a Accept: */*
  %a Icy-MetaData:0
  %a Connection: close
  %a
}
on *:sockread:shoutcast: {
  var %a
  if (!$hget(shout,head)) {
    sockread %a
    while ($sockbr) {
      if (%a) {
        tokenize 58 %a
        if (%a == ICY 200 OK) { disp Connected successfuly }
        elseif ($1 == icy-name) { did -ra shout 13 $2- }
        elseif ($1 == icy-genre) { did -ra shout 19 $2- }
        elseif ($1 == icy-url) { did -ra shout 15 $2- }
      }
      if (icy-br:* iswm %a) { hadd shout head 1 | did -ra shout 17 $2 | .timershout -m 0 500 shoutinf | break }
      sockread %a
    }
  }
  else {
    sockread &a 8192
    while ($sockbr) {

      if ($hget(shout,play)) {
        var %f = $+(shtmp,$hget(shout,wrt),.mp3)
        bwrite %f -1 -1 &a

        if ($file(%f).size >= 131072) {
          if ($hget(shout,wrt) == 3) hadd shout wrt 1
          else hinc shout wrt 1
          if (!$hget(shout,ready)) { hinc shout ready | splay %f | disp Play: buffering ok, now playing }
          else splay -q %f
          write -c $+(shtmp,$hget(shout,wrt),.mp3)
        }
      }
      bwrite $shortfn($hget(shout,file)) -1 -1 &a
      sockread &a 8192
    }
  }
}
alias -l shoutinf {
  did -ra shout 20 $duration($calc($sound($shortfn($hget(shout,file))).length /1000))
  did -ra shout 21 $bytes($file($shortfn($hget(shout,file))).size,m) Mb
}
alias disp { did -a shout 6 $1- | did -c shout 6 $did(shout,6).lines }
alias -l shp {
  if ($1 == -p) {
    write -c shtmp1.mp3 | write -c shtmp2.mp3 | write -c shtmp3.mp3
    hadd shout play 1 | hadd shout ready 0 | hadd shout wrt 1
    disp Play: Please Wait (buffering 128kb) ...
    hadd shout ispl 1
  }
  if ($1 == -s) {
    splay stop | hadd shout play 0 | hadd shout ready 0 | hadd shout wrt 1 | hadd shout ispl 0
    if ($isfile(shtmp1.mp3)) .remove shtmp1.mp3 | if ($isfile(shtmp2.mp3)) .remove shtmp2.mp3
    if ($isfile(shtmp3.mp3)) .remove shtmp3.mp3
    disp Play: Stopped
  }
}
dialog -l box {
  title Text-Box - %bsver
  size "-1 -1 400 205"
  box "Theme", 1, 3 3 187 200
  button "Add Theme", 2, 37 18 100 20, flat
  list 3, 9 39 175 166, vsbar

  box "Text..", 6, 200 3 195 90
  edit "Deine Nachricht!", 7, 207 21 180 66, multi return vsbar
  button "Anzeigen", 8, 200 97 195 35, flat
}
dialog -l addtheme {
  title Neue Box - %bsver
  size "-1 -1 200 109"

  text "Vordergrund Farbe", 1, 3 7 100 15
  text "Hintergrund Farbe", 2, 3 27 100 15
  text "Schriftfarbe", 3, 3 47 50 15

  edit "", 4, 90 3 95 20, flat
  edit "", 5, 90 23 95 20, flat
  edit "", 6, 90 43 95 20, flat
  edit "Theme Title..", 7, 3 67 194 20

  button "Hinzufügen", 8, 3 89 194 18, flat 
}
on *:dialog:addtheme:sclick:8 {
  writeini $scriptdirboxes.ini $replace($did(addtheme,7).text,$chr(32),_) FG $remove($did(addtheme,4).text,)
  writeini $scriptdirboxes.ini $replace($did(addtheme,7).text,$chr(32),_) BG $remove($did(addtheme,5).text,)
  writeini $scriptdirboxes.ini $replace($did(addtheme,7).text,$chr(32),_) FC $remove($did(addtheme,6).text,)
  echo 4 -at Theme " $+ $did(addtheme,7).text $+ " added.
  dialog -x addtheme
  dialog -x box
  dialog -mdv box box
}
on *:dialog:box:sclick:2 { 
  dialog -mdov addtheme addtheme
}
on *:dialog:box:sclick:8 {
  var %this = 0
  while (%this < $did(box,7).lines) {
    inc %this 1
    if ([ $did(box,7,%this).len ] > %toplen) || (!%toplen) {
      var %toplen = $did(box,7,%this).len
    }
  }
  msg $active $+(%FG,$str( ,$calc(%toplen + 4)))
  var %this = 0
  while (%this < [ $did(box,7).lines ]) {
    inc %this 1
    var %thislen = $did(box,7,%this).len
    msg $active $+(%FC,  ,$did(box,7,%this).text,$str( ,$calc(%toplen - %thislen)),  ,%BG,  )
  }
  msg $active $+(%FG,$str( ,$calc(%toplen + 4)),%BG,  )
  msg $active $+(  ,%BG,$str( ,$calc(%toplen + 4)))
  dialog -x box
}
on *:dialog:box:init:* {
  var %this = 0
  while (%this < $ini($scriptdirboxes.ini,0)) {
    inc %this 1
    did -a box 3 $ini($scriptdirboxes.ini,%this)
  }
}
on *:dialog:box:*:3 {
  set %BG  $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,BG),) $+ , $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,BG),)
  set %FG  $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,FG),) $+ , $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,FG),)
  set %FC  $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,FC),) $+ , $+ $remove($readini($scriptdirboxes.ini,$did(box,3,1).seltext,FG),)
  echo -a %FG                  
  echo -a %FC Theme Vorschau.. %BG $+   
  echo -a %FG                  %BG $+   
  echo -a   %BG                  
}
ALIAS box { 
  dialog -mdv box box
}

;* Browser

Alias -l html { dll $+(",$mircdirdll\nHTMLn_2.95.dll,") $1- } 
Alias -l nhtml { return $+(",$mircdirdll\nHTMLn_2.95.dll,") }
Alias -l mdx.fullpath { return $+(",$mircdirdll\mdx.dll,") }
Alias -l mdxinit { dll $mdx.fullpath SetMircVersion $version | dll $mdx.fullpath MarkDialog $dname }
Alias -l mdx { dll $mdx.fullpath $1- }
Alias -l di.open { 
  if (!$2) { if ($dialog($1) != $null) { dialog -ve $1 } | else { dialog -mod $1 $1 } }
  else { if ($dialog($1) != $null) { dialog -ve $1 } | else { dialog - $+ $$2 $1 $1 } }
}
Alias -l start.wbv {
  mdxinit | if (%webvDOCk != none) { mdx SetDialog $dname style dlgmodal }
  mdx SetControlMDX $dname 1,2,3,4,5,6,7 ToolBar list nodivider flat > $mircdirdll\bars.mdx
  mdx SetControlMDX $dname 10 ProgressBar > $mircdirdll\ctl_gen.mdx
  if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6,7 14 900 Arial }
  mdx SetBorderStyle $dname 1,2,3,4,5,6,7 windowedge
  mdx SetDialog $dname bgcolor $rgb(199,199,199)
  mdx SetColor 1,2,3,4,5,6,7 textbg $rgb(199,199,199)
  mdx SetColor 1,2,3,4,5,6,7 background $rgb(199,199,199)
  tb 1 Zurück 11 Blätter zurück 
  tb 2 Vor 8 Blätter zurück
  tb 3 Refresh 12 Refresh Current Page
  tb 4 Stop 10 Stop Page Download
  tb 5 Start 5 Gehe zur Homepage
  tb 6 Favoriten 13 Favoriten Ordner
  tb 7 Beenden 7 Schliesse Browser
}
Alias -l dock { 
  if (%webvDOCK == toolbar) { dll $+(",$mircdirdll\ktools.dll,") DockToolbar $dialog($$1).hwnd }
  if (%webvDOCK == switch) { dll $+(",$mircdirdll\ktools.dll,") DockSwitchbar $dialog($$1).hwnd }
  if (%webvDOCK == none) { dialog -sdb wbv $window(-3).x $window(-3).y 373 11 } 
}
Alias -l tb {
  did -i $dname $1 1 bmpsize 16 16
  did -i $dname $1 1 setimage +nh icon small $3 $+ , $+ $scriptdiricons\sbar.icl
  did -a $dname $1 1 $2 $chr(9) $4-
}
dialog wbv {
  title Internet Browser - %bsver
  size -1 -1 802 21
  option dbu
  icon $scriptdiricons\sbar.icl $+ , 4
  list 1, 1 0 40 11, size
  list 2, 40 0 29 11, size
  list 3, 67 0 40 11, size
  list 4, 104 0 29 11, size
  list 6, 239 0 46 11, size
  list 5, 213 0 25 11, size
  list 7, 286 0 1900 11, size
  combo 8, 133 0 79 50, size edit drop
  text "", 9, 350 100 100 100
  text "", 10, 322 2 50 7
}
Alias -l www {
  window -Bk0 $1 
  html attach $window($1).hwnd
  html navigate $2-
  echo -a $dll($nhtml,handler,progress.handler)
}
;Page progress
;-------------
Alias progress.handler {
  var %change = $1-
  if ($dialog(wbv)) { 
    did -i wbv 8 0 $dll($nhtml,url,$1-) 
    if (progress_change isin %change) { did -a wbv 10 0 0 $gettok(%change,4,32) | did -ra wbv 10 $gettok(%change,3,32) }
  }

  return S_OK
}
Alias -l back { html back $window($1).hwnd }
Alias -l fwd { html forward $window($1).hwnd }
Alias -l rfsh { html refresh $window($1).hwnd }
Alias -l stop { html stop $window($1).hwnd }
Alias go { 
  if (!$1) { www $newindow($window(0)) www.google.com }
  if ($1) { www $newindow($window(0)) $1- }
  if ($dialog(wbv)) { did -a wbv 8 $1- } 
}
Alias newindow { 
  var %w = 1,%wins = 1
  while ($window(%w)) {
    if (web isin $ifmatch) { inc %wins }
    inc %w 
  }
  :winname
  var %window = $+(@web,%wins)
  if ($window(%window)) { inc %wins | goto winname }
  return %window
}
On *:active:@web*:{ if ($dialog(wbv)) { did -ra wbv 9 $active } }
On *:dialog:wbv:init:0:{ dock $dname | start.wbv }
On *:dialog:wbv:sclick:1:{ back $did(9) }
On *:dialog:wbv:sclick:2:{ fwd $did(9) }
On *:dialog:wbv:sclick:3:{ rfsh $did(9) }
On *:dialog:wbv:sclick:4:{ stop $did(9) }
On *:dialog:wbv:sclick:5:{ go $did(8) }
On *:dialog:wbv:sclick:6:{ di.open fvr -mod }
On *:dialog:wbv:sclick:7:{ .timerCLOSEWBV -h 1 1 dialog -x wbv }
;favorites
;---------
dialog fvr {
  title Favoriten - %bsver
  size $window(-3).x $window(-3).y  117 184
  option dbu
  icon $scriptdiricons\sbar.icl $+, 13
  list 1, 0 0 117 134, size
  edit "", 2, 19 140 94 12, return autohs
  edit "", 3, 19 152 94 12, return autohs
  list 4, 9 169 101 11, size
  text "Site", 5, 5 143 14 8, disable
  text "URL", 6, 5 155 14 8, disable
  box "", 7, 1 134 115 49
  box "", 8, 1 163 115 20
}
Alias -l load.table { if (!$hget($1)) { hmake $1 100 | if ($isfile($+(",$mircdirsys,$1,.hsh,")) == $true) { hload $1 $+(",$mircdirsys,$1,.hsh,") } } }
Alias -l save.table { hsave -o $1 $+(",$mircdirsys,$1,.hsh,") }
Alias -l start.fvr {
  mdxinit | if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6 14 900 Arial }
  mdx SetControlMDX $dname 4 ToolBar list nodivider > $mircdirdll\bars.mdx
  mdx SetBorderStyle $dname 1,4 windowedge
  mdx SetControlMDX $dname 1 ListView report rowselect single sortascending > $mircdirdll\views.mdx
  did -i $dname 1 1 headerdims 110 110
  did -i $dname 1 1 headertext Site $chr(9) Url
  did -i $dname 4 1 bmpsize 16 16  
  did -i $dname 4 1 setimage +nh icon small 6, $+ $scriptdiricons\sbar.icl
  did -i $dname 4 1 setimage +nh icon small 7, $+ $scriptdiricons\sbar.icl
  did -i $dname 4 1 setimage +nh icon small 10, $+ $scriptdiricons\sbar.icl
  did -a $dname 4 1 Neu $chr(9) Homepage hinzufügen
  did -a $dname 4 2 Löschen $chr(9) Lösche Homepage aus der Liste
  did -a $dname 4 3 Exit $chr(9) Exit 
}
Alias -l start.ngs {
  mdxinit | if ($os == xp) { mdx SetFont $dname 1,2,3,4,5,6 14 900 Arial }
  mdx SetControlMDX $dname 4 ToolBar list nodivider > $mircdirdll\bars.mdx
  mdx SetBorderStyle $dname 1,4 windowedge
  mdx SetControlMDX $dname 1 ListView report rowselect single sortascending > $mircdirdll\views.mdx
  did -i $dname 1 1 headerdims 110 110
  did -i $dname 1 1 headertext Game $chr(9) Url
  did -i $dname 4 1 bmpsize 16 16  
  did -i $dname 4 1 setimage +nh icon small 6, $+ $scriptdiricons\sbar.icl
  did -i $dname 4 1 setimage +nh icon small 7, $+ $scriptdiricons\sbar.icl
  did -i $dname 4 1 setimage +nh icon small 10, $+ $scriptdiricons\sbar.icl
  did -a $dname 4 1 Neu $chr(9) Game in die Liste hinzufügen
  did -a $dname 4 2 Löschen $chr(9) Lösche Game von der Liste
  did -a $dname 4 3 Exit $chr(9) Exit 
}

Alias favorites { 
  var %f = 1
  if ($hget($1)) { 
    did -r $1 1 
    while ($hget($1,%f).data) { did -a $1 1 $hget($1,%f).item $chr(9) $ifmatch | inc %f }
  }
}
On *:dialog:fvr:init:0:{ start.fvr | load.table $dname | save.table $dname | favorites $dname }
On *:dialog:fvr:close:0:{ save.table  $dname | hfree fvr }
On *:dialog:fvr:dclick:1:{ go $gettok($did(1).seltext,11-,32) }
On *:dialog:fvr:sclick:4:{ 
  var %id = $did(4).sel
  if (%id == 2) && ($did(2) != $null) && ($did(3) != $null) { 
    hadd fvr $replace($did(2),$chr(32),-) $did(3)
    favorites $dname | did -rf $dname 3,2
  }
  if (%id == 3) && ($did(1).sel) { hdel fvr $gettok($did(1).seltext,6,32) | favorites $dname }
  if (%id == 4) { .timerCLOSEFVR -h 1 1 dialog -x $dname }
}

dialog ngs {
  title NetGames - %bsver
  size $window(-3).x $window(-3).y 150 184
  option dbu
  icon $scriptdiricons\sbar.icl $+ , 13
  list 1, 0 0 150 134, size
  edit "", 2, 19 140 94 12, return autohs
  edit "", 3, 19 152 94 12, return autohs
  list 4, 9 169 101 11, size
  text "Game", 5, 3 143 16 8, disable
  text "URL", 6, 3 155 16 8, disable
  box "", 7, 1 134 115 49
  box "", 8, 1 163 115 20
}
On *:dialog:ngs:init:0:{ start.ngs | load.table $dname | save.table $dname | favorites $dname }
On *:dialog:ngs:close:0:{ save.table  $dname | hfree ngs }
On *:dialog:ngs:dclick:1:{ go $gettok($did(1).seltext,11-,32) }
On *:dialog:ngs:sclick:4:{ 
  var %id = $did(4).sel
  if (%id == 2) && ($did(2) != $null) && ($did(3) != $null) { 
    hadd ngs $replace($did(2),$chr(32),-) $did(3)
    favorites $dname | did -rf $dname 3,2
  }
  if (%id == 3) && ($did(1).sel) { hdel ngs $gettok($did(1).seltext,6,32) | favorites $dname }
  if (%id == 4) { .timerCLOSENGS -h 1 1 dialog -x $dname }
}
On *:start:{ if (%webvST == yes) { di.open wbv -mod } }
Alias browser { di.open wbv -mod }
Alias favoriten { di.open fvr -md }
Alias netgames { di.open ngs -md }

;* Browser Ende

;* Channel Rekord

alias -l usercount.percent return $round($calc(($1 / $2) * 100),$iif($3,$3,2))

alias usercount.percentage {
  set %usc.o $usercount.percent($readini(usercount.ini, $did(usercount,2).text, $& 
    O),$readini(usercount.ini, $did(usercount,2).text, MaxCount),2)
  set %usc.h $usercount.percent($readini(usercount.ini, $did(usercount,2).text, $& 
    H),$readini(usercount.ini, $did(usercount,2).text, MaxCount),2)
  set %usc.v $usercount.percent($readini(usercount.ini, $did(usercount,2).text, $& 
    R),$readini(usercount.ini, $did(usercount,2).text, MaxCount),2)
  set %usc.r $usercount.percent($readini(usercount.ini, $did(usercount,2).text, $& 
    V),$readini(usercount.ini, $did(usercount,2).text, MaxCount),2)
}

alias -l usercount.Say {
  if ($did(usercount,2).text == $null) { 
    if ($Input(Wähle ein Channel vorher aus !,o,Fehler)) { 
      dialog -v usercount usercount 
      did -f usercount 2 
      halt 
    } 
  }
  usercount.percentage
  msg $active : 11,1Im8 $did(usercount,2).text 11wurde der Channelrekord mit4 $readini(usercount.ini, $did(usercount,2).text, $& 
    MaxCount) 11Usern am9 $readini(usercount.ini, $did(usercount,2).text, MaxCountDate) 11aufgestellt.
  msg $active : 11,1Anteilig waren es8 < $+ %usc.o $+ % $+ > 11OP,4 < $+ %usc.h $+ % $+ > 11HalfOP,9 $& 
    < $+ %usc.v $+ % $+ > 11Voice und7  < $+ %usc.r $+ % $+ > 11Normale User. 
}

alias usercount {
  if ($dialog(usercount)) {
    dialog -ve usercount usercount
    usercount.fill
  }
  else { 
    dialog -md usercount usercount 
  }
} 

alias -l usercount.fill {
  did -r usercount 2
  did -f usercount 2
  var %i 1
  var %usc $ini(usercount.ini,0)
  while (%i <= %usc) { 
    did -a usercount 2 $ini(usercount.ini,%i)  
    inc %i
  }
}

dialog usercount {
  title Raumrekorde - %bsver
  size -1 -1 100 120
  option dbu
  text "Raumauswahl :", 1, 5 5 50 10
  combo  2, 5 15 50 10, sort drop  
  text "Am :", 3, 5 40 20 10
  text "Max :", 4, 5 30 30 10
  box "User-Status", 5, 5 50 50 55, left
  text "OP", 6, 10 60 15 10
  text "HalfOp", 7, 10 70 20 10
  text "Voice", 8, 10 80 15 10
  text "Normal", 9, 10 90 20 10
  edit "", 10, 30 60 20 10, read center
  edit "", 11, 30 70 20 10, read center 
  edit "", 12, 30 80 20 10, read center
  edit "", 13, 30 90 20 10, read center
  edit "", 14, 30 30 25 10, read center
  edit "", 15, 20 40 35 10, read center
  button "Msg", 16, 60 50 35 10, flat
  button "Über", 17, 60 65 35 10, flat
  ; button "Leer", 18, 60 80 35 10, flat
  button "Ende", 19, 60 95 35 10, flat ok
  button "Löschen", 20, 60 15 35 10, flat
  text "www.bandyscript.de", 21, 5 110 90 10, disabled center
}

on *:dialog:usercount:init:*: {
  if ($exists(usercount.ini) == $false) {
    halt 
  }
  usercount.fill
  did -u $dname 2 1
  did -r $dname 10,11,12,13,14,15
  did -a $dname 10 $readini(usercount.ini, $did(usercount,2).text, o)
  did -a $dname 11 $readini(usercount.ini, $did(usercount,2).text, h)
  did -a $dname 12 $readini(usercount.ini, $did(usercount,2).text, v)
  did -a $dname 13 $readini(usercount.ini, $did(usercount,2).text, r)
  did -a $dname 14 $readini(usercount.ini, $did(usercount,2).text, maxcount)
  did -a $dname 15 $readini(usercount.ini, $did(usercount,2).text, maxcountdate)
}

on *:JOIN:#: {
  set %usc.current $nick($chan,0)
  if ($readini(usercount.ini, $chan, MaxCount) == $null) {
    writeini usercount.ini $chan MaxCount 0 
  }
  if (%usc.current >= $readini(usercount.ini, $chan, MaxCount) ) {  
    writeini usercount.ini $chan MaxCount %usc.current
    writeini usercount.ini $chan MaxCountDate $date
    writeini usercount.ini $chan O $nick($chan,0,o)
    writeini usercount.ini $chan H $nick($chan,0,h)
    writeini usercount.ini $chan V $nick($chan,0,v)
    writeini usercount.ini $chan R $nick($chan,0,r)
  }
}

on *:dialog:usercount:sclick:* {
  if ($did == 16) {
    usercount.say
  }
  elseif ($did == 18) { 
    usercount.hlp
  }
  elseif ($did == 20) {
    if ($did(usercount,2).text == $null) { 
      if ($Input(Bitte einen Channel markieren !,o,Fehler)) { 
        dialog -v usercount usercount 
        did -f usercount 2 
      }
    }
    if ($did(usercount,2).text != $null) { 
      if ($input(Soll der Channel inkl. Rekordinformationen von $did(usercount,2).text ?, y, Lösche Daten) == $true) { 
        remini usercount.ini $did(usercount,2).text 
        echo -a Info Channelrekord  $did(usercount,2).text gelöscht...
        dialog -v usercount usercount 
        usercount.fill
        did -f usercount 2 
        did -u $dname 2 1
      }
      else { 
        dialog -v usercount usercount 
        did -f usercount 2 
        echo -a Info Channelrekord $did(usercount,2).text nicht gelöscht...
      }
    }
  }
  elseif ($did == 17) { 
    if ($input( Channelrekord $crlf im bIRC %bsver $crlf ,o,Über !)) {
      dialog -v usercount usercount 
    } 
  }  
  elseif ($did == 2) {
    did -r $dname 10,11,12,13,14,15
    did -a $dname 10 $readini(usercount.ini, $did(usercount,2).text, o)
    did -a $dname 11 $readini(usercount.ini, $did(usercount,2).text, h)
    did -a $dname 12 $readini(usercount.ini, $did(usercount,2).text, v)
    did -a $dname 13 $readini(usercount.ini, $did(usercount,2).text, r)
    did -a $dname 14 $readini(usercount.ini, $did(usercount,2).text, maxcount)
    did -a $dname 15 $readini(usercount.ini, $did(usercount,2).text, maxcountdate)
  }
}

;* Channel Rekord Ende

;* DVD Player

alias dvdstart {
  var %x $+(@,DVD,$chr(160),Player,$chr(160),2.2)
  if ($window(%x)) { window -a %x }
  else { window -ak0 %x $scriptdiricons\dvd.ico | window -x %x }
  dvdiniate %x
}
alias -l nhtmln { return $mircdirdll\nhtmln.dll }

alias -l dvdiniate {
  var %y = $dll($nHTMLn,attach,$window($1).hwnd)
  htmlwrite1 $1
  dll $nhtmln navigate $mircdirdvd.html
}

alias -l htmlwrite1 {
  write -c $mircdirdvd.html
  if (%s.control == top) {
    write $mircdirdvd.html <html>
    write $mircdirdvd.html <BODY onload=BoxPop()>
    write $mircdirdvd.html <BODY oncontextmenu="return false">
    write $mircdirdvd.html  <form name="dvdchap"> <div align="center"> 
    write $mircdirdvd.html <select name="chapter" size ="1" 
    write $mircdirdvd.html onchange="ChapPlay(document.dvdchap.chapter.options[document.dvdchap.chapter.selectedIndex].value);"> 
    write $mircdirdvd.html <option value= "Pick A Chapter" selected="Selected">Wähle ein Kapitel</option> 
    write $mircdirdvd.html </select>
    write $mircdirdvd.html </div> 
    write $mircdirdvd.html </form> 
    write $mircdirdvd.html <BUTTON onClick='PrevChapter();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >9</font></button>
    write $mircdirdvd.html <BUTTON onClick='Rewind();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >7</font></button>
    write $mircdirdvd.html <BUTTON onClick='Stop();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") > $+ $chr(60) $+ </font></button>
    write $mircdirdvd.html <BUTTON onClick='Play();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >4</font></button>
    write $mircdirdvd.html <BUTTON onClick='Pause();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >;</font></button>
    write $mircdirdvd.html <BUTTON onClick='FastForward();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >8</font></button>
    write $mircdirdvd.html <BUTTON onClick='NextChapter();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >:</font></button>
    write $mircdirdvd.html <BUTTON onClick='Eject();'><u><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >5</u></font></button>
    write $mircdirdvd.html <ALIGN="right">DVD-Player für mIRC ©2004 Soul_Eater im bIRC %bsver
    write $mircdirdvd.html  <SCRIPT LANGUAGE="JScript">
    write $mircdirdvd.html function BoxPop(){
    write $mircdirdvd.html var chapts = DVD.GetNumberOfChapters(1);
    write $mircdirdvd.html var selbox = document.dvdchap.chapter;
    write $mircdirdvd.html selbox.options.length = 1;
    write $mircdirdvd.html while (chapts >= 0) $chr(123)
    write $mircdirdvd.html selbox.options[selbox.options.length] = new Option(chapts,chapts);
    write $mircdirdvd.html chapts--;
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function ChapPlay(chosen){
    write $mircdirdvd.html DVD.PlayChapterInTitle(1,chosen);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html  function Play(){ 
    write $mircdirdvd.html  DVD.Play();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Pause(){
    write $mircdirdvd.html DVD.Pause();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Stop(){
    write $mircdirdvd.html DVD.Stop();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Eject(){
    write $mircdirdvd.html DVD.Eject();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Rewind(){
    write $mircdirdvd.html DVD.PlayBackwards(2.0);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function FastForward(){
    write $mircdirdvd.html DVD.PlayForwards(2.0);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function NextChapter(){
    write $mircdirdvd.html DVD.PlayNextChapter();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function PrevChapter(){
    write $mircdirdvd.html DVD.PlayPrevChapter();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html </SCRIPT>
    write $mircdirdvd.html <br>
    write $mircdirdvd.html <hr width=100% size=7>
    write $mircdirdvd.html <br>
    write $mircdirdvd.html  <OBJECT CLASSID=clsid:38EE5CEE-4B62-11D3-854F-00A0C9C898E7 ID=DVD 
    write $mircdirdvd.html   $+(STYLE="height:,$+($calc($window($1).h - 178),px,;),$chr(32),width:,$+($calc($window($1).w - 65),px">))
    write $mircdirdvd.html  <PARAM NAME="BackColor" VALUE="1048592">
    write $mircdirdvd.html   <PARAM NAME="EnableResetOnStop" VALUE="0">
    write $mircdirdvd.html  <PARAM NAME="ColorKey" VALUE="1048592">
    write $mircdirdvd.html  </OBJECT>
    write $mircdirdvd.html </body>
    write $mircdirdvd.html </html>
  }
  if (%s.control == bottom) {
    write $mircdirdvd.html <html>
    write $mircdirdvd.html <BODY onload=BoxPop()>
    write $mircdirdvd.html <BODY oncontextmenu="return false">
    write $mircdirdvd.html  <OBJECT CLASSID=clsid:38EE5CEE-4B62-11D3-854F-00A0C9C898E7 ID=DVD 
    write $mircdirdvd.html   $+(STYLE="height:,$+($calc($window($1).h - 195),px,;),$chr(32),width:,$+($calc($window($1).w - 65),px">))
    write $mircdirdvd.html  <PARAM NAME="BackColor" VALUE="1048592">
    write $mircdirdvd.html   <PARAM NAME="EnableResetOnStop" VALUE="0">
    write $mircdirdvd.html  <PARAM NAME="ColorKey" VALUE="1048592">
    write $mircdirdvd.html  </OBJECT>
    write $mircdirdvd.html <br><br>
    write $mircdirdvd.html <hr width=100% size=7>
    write $mircdirdvd.html  <form name="dvdchap"> <div align="center"> 
    write $mircdirdvd.html <select name="chapter" size ="1" 
    write $mircdirdvd.html onchange="ChapPlay(document.dvdchap.chapter.options[document.dvdchap.chapter.selectedIndex].value);"> 
    write $mircdirdvd.html <option value= "Pick A Chapter" selected="Selected">Wähle ein Kapitel</option> 
    write $mircdirdvd.html </select>
    write $mircdirdvd.html </div> 
    write $mircdirdvd.html </form> 
    write $mircdirdvd.html <BUTTON onClick='PrevChapter();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >9</font></button>
    write $mircdirdvd.html <BUTTON onClick='Rewind();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >7</font></button>
    write $mircdirdvd.html <BUTTON onClick='Stop();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") > $+ $chr(60) $+ </font></button>
    write $mircdirdvd.html <BUTTON onClick='Play();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >4</font></button>
    write $mircdirdvd.html <BUTTON onClick='Pause();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >;</font></button>
    write $mircdirdvd.html <BUTTON onClick='FastForward();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >8</font></button>
    write $mircdirdvd.html <BUTTON onClick='NextChapter();'><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >:</font></button>
    write $mircdirdvd.html <BUTTON onClick='Eject();'><u><FONT FACE="WebDings" $+(SIZE,=,",%s.button,") >5</u></font></button>
    write $mircdirdvd.html <ALIGN="left">DVD-Player für mIRC ©2004 Soul_Eater im bIRC %bsver
    write $mircdirdvd.html  <SCRIPT LANGUAGE="JScript">
    write $mircdirdvd.html function BoxPop(){
    write $mircdirdvd.html var chapts = DVD.GetNumberOfChapters(1);
    write $mircdirdvd.html var selbox = document.dvdchap.chapter;
    write $mircdirdvd.html selbox.options.length = 1;
    write $mircdirdvd.html while (chapts >= 0) $chr(123)
    write $mircdirdvd.html selbox.options[selbox.options.length] = new Option(chapts,chapts);
    write $mircdirdvd.html chapts--;
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function ChapPlay(chosen){
    write $mircdirdvd.html DVD.PlayChapterInTitle(1,chosen);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html  function Play(){ 
    write $mircdirdvd.html  DVD.Play();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Pause(){
    write $mircdirdvd.html DVD.Pause();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Stop(){
    write $mircdirdvd.html DVD.Stop();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Eject(){
    write $mircdirdvd.html DVD.Eject();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function Rewind(){
    write $mircdirdvd.html DVD.PlayBackwards(2.0);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function FastForward(){
    write $mircdirdvd.html DVD.PlayForwards(2.0);
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function NextChapter(){
    write $mircdirdvd.html DVD.PlayNextChapter();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html function PrevChapter(){
    write $mircdirdvd.html DVD.PlayPrevChapter();
    write $mircdirdvd.html $chr(125)
    write $mircdirdvd.html </SCRIPT>
    write $mircdirdvd.html </body>
    write $mircdirdvd.html </html>
  }
}
on *:close:@DVD Player:.remove $mircdirdvd.html
on *:exit:.remove $mircdirdvd.html
dialog dvd.about {
  title "Über DVD Player"
  icon $scriptdiricons\dvd.ico 
  size -1 1 300 100
  button "",55,0 0 0 0,cancel
  text "DVD ©2003-04 Soul_Eater",1, 50 30 200 20
  text "nHTMLn by Necroman",2, 50 55 200 20
  text "Contact: souleata@xrs.net AIM: SoulEata",3, 50 70 300 20
}

;* DVD Player Ende

*; Windows Media Player

alias mwplayer if (!$dialog(mediaplyr)) dialog -m $+ $1 mediaplyr mediaplyr

dialog mediaplyr {
  title Win Media Player - %bsver
  size -1 -1 350 300
  icon $shortfn($scriptdiricons\mediaplayer.icl), 1
  text "", 1,1 0 345 300
  list 2,0 1 1 25
  menu "&Datei", 3 3
  item "&Öffne Datei", 4, 3
  item "Datei &hinzufügen", 5, 3
  item break, 6, 3
  item "&Pfadvorgabe", 7, 3
  item "&Pfad hinzufügen", 8, 3
  item break, 9, 3
  item "E&nde", 10, 3
  menu "&Optionen", 11 11
  menu "&Playliste", 12, 11
  item break, 13, 11
  item "Öffne auf dem &Desktop", 14, 12
  item "Öffne im &bIRC", 15, 12 
  item "&Lösche Playliste", 16, 11
  item break, 26, 11
  item "&Lautstärke", 27, 11
  item break, 17, 12
  menu "&Transparenz", 18, 12
  item "keine", 19, 18
  item "10", 20, 18
  item "20", 21, 18
  item "30", 22, 18
  item "40", 23, 18
  item "50", 24, 18
  item "60", 25, 18
  item "70", 28, 18
  item "80", 29, 18
  item "90", 30, 18
  item "100", 31, 18 
  menu "&Hilfe", 32 32 
  item "&Hilfe", 33, 32
  item "&ReadMe", 34, 32
  item break, 35, 32
  item "&E-mail", 36, 32 
  item "&Website", 37, 32
  button "Position", 38,0 0 0 0
}

alias -l mwlist if (!$dialog(mediaplyl)) dialog -mo $+ $1 mediaplyl mediaplyl

dialog mediaplyl {
  title Win Media Player %bsver
  size 0 0 270 300
  icon $shortfn($scriptdiricons\mediaplayer.icl), 2
  list 1,0 25 270 300, size
  menu "&Datei", 2 2 
  item "Datei &hinzufügen", 3, 2
  item break, 4, 2
  item "&Pfadvorgabe", 5, 2
  item "&Pfad hinzufügen", 6, 2
  item break, 7, 2
  item "E&nde", 8, 2
  menu "&Optionen", 9 9
  item "&Lösche Playliste", 10, 9
  item break, 11, 9
  item "Konvertiere in &HTML", 12, 9
  item "&Zeige HTML Playliste", 13, 9
  item "&DCC HTML Playliste", 14, 9
  item break, 15, 9
  item "L&ösche HTML Playlist", 16, 9
  item break, 17, 9
  menu "&Spam Option", 18, 9
  item &active, 19, 18
  item /a&msg, 20, 18
  item &nicht, 21, 18 
  item break, 28, 9
  item "&Lautstärke", 29, 9
  button "Position", 22,0 0 0 0
  button "Play", 23, 0 0 0 0, hide default
  button "9", 24, 75 0 25 20
  button "4", 25, 105 0 25 20
  button "<", 26, 135 0 25 20
  button ":", 27, 165 0 25 20 
}

on *:dialog:mediaplyl:*:*:{
  if ($devent == init) {
    setmdx
    dll $dll.path(mdx) SetControlMDX 1 ListView headerdrag report rowselect showsel single > $views
    did -i $dname 1 1 headerdims 185:1 60:2
    did -i $dname 1 1 headertext Media File(s): $chr(9) Size(s): $chr(9)
    did -i $dname 1 1 setbkg color $rgb(0,0,0)
    did -i $dname 1 1 settxt color $rgb(225,225,225)
    did -i $dname 1 1 settxt bgcolor $rgb(0,0,0)
    dll $dll.path(mdx) SetControlMDX $dname 22 positioner minbox size > $dialogs
    dll $dll.path(mdx) SetBorderStyle 24,25,26,27 staticedge
    dll $dll.path(mdx) SetFont $dname 24,25,26,27 20 100 webdings
    dll $dll.path(tdialog) TDDialog $dialog($dname).hwnd > %mtdialog
    if (%msg.mwfile == 1) { did -c $dname 19 | did -u $dname 20 | did -u $dname 21 }
    elseif (%msg.mwfile == 2) { did -u $dname 19 | did -c $dname 20 | did -u $dname 21 }
    elseif (%msg.mwfile == 3) { did -u $dname 19 | did -u $dname 20 | did -c $dname 21 } 
    if ($exists($shortfn($scriptdirmediaplaylist.html))) {
      did -e $dname 13 
      did -e $dname 14 
      did -e $dname 16
    } 
    else { 
      did -b $dname 13 
      did -b $dname 14 
      did -b $dname 16
    }
    MediaPlist
  }
  if ($devent == sclick) { 
    if ($did == 1) {
      if ($gettok($did($dname,1,1),1,32) != rclick) halt
      dll $dll.path(popup) New media 16 16
      dll $dll.path(popup) LoadImg media icon small 3, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 4, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 5, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 6, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 1 1 &Play $cr popplay
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 2 2 &Hinzufügen $cr add.mwfile
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 3 3 &Lösche $cr del.mwfile
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 4 4 &Sende $cr send.mwfile
      pop media $mouse.dx $mouse.dy
    }
    if ($did == 22) {
      var %action = $gettok($did($dname,22),1,32)
      if (%action == size) {
        var %w = $dialog($dname).cw,%h = $dialog($dname).ch
        dll $dll.path(mdx) MoveControl $dname 1 * * $calc(%w - 2) $calc(%h - 26) 
      }
    }
    if ($did == 23) && ($did($dname,1).sel) { popplay }
    if ($did == 24) { prev.file }
    if ($did == 25) && ($did($dname,1).sel) { popplay }
    if ($did == 26) { stoplay }
    if ($did == 27) { next.file }
  }
  if ($devent == menu) {
    if ($did == 3) { add.mwfile }
    if ($did == 5) { set.mwdir }
    if ($did == 6) { add.mwdir }
    if ($did == 8) { dialog -c $dname }
    if ($did == 10) { mw.cls }
    if ($did == 12) { 
      set %convert2html 1
      MediaPlist
      did -e $dname 13 | did -e $dname 14 | did -e $dname 16
    }
    if ($did == 13) { 
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        run $shortfn($scriptdirmediaplaylist.html)
      }
    }
    if ($did == 14) {
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        dcc send $$?="An welchen Nick soll die HTML Playliste gesendet werden:" $shortfn($scriptdirmediaplaylist.html)
      }
    }
    if ($did == 16) {
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        if ( $+ $input(Bist Du Dir sicher die HTML Playliste zu löschen?,200,Hinweis) == $true) {
          .remove $shortfn($scriptdirmediaplaylist.html)
          did -b $dname 13 | did -b $dname 14 | did -b $dname 16
        }
      }
    }
    if ($did == 19) {
      set %msg.mwfile 1 
      did -c $dname 19
      did -u $dname 20
      did -u $dname 21
    }
    if ($did == 20) {
      set %msg.mwfile 2
      did -u $dname 19
      did -c $dname 20
      did -u $dname 21
    }
    if ($did == 21) {
      set %msg.mwfile 3
      did -u $dname 19
      did -u $dname 20
      did -c $dname 21
    }
    if ($did == 29) { run sndvol32.exe }
  }
  if ($devent == dclick) { 
    if ($did == 1) { 
      popplay
    }
  }
}

on *:dialog:mediaplyr:*:*:{
  if ($devent == init) {
    setmdx
    dll $dll.path(mdx) SetControlMDX $dname 38 positioner maxbox minbox size > $dialogs
    sc_start $dname 2 270 l 70 Willkommen im Windows Media Player
    dll $dll.path(mdx) SetColor $dname 1 background $rgb(0,0,0)
    dll $dll.path(mdx) SetBorderStyle 2
    dll $dll.path(mdx) SetColor $dname 2 background $rgb(face)
    dll $dll.path(mdx) SetColor $dname 2 textbg $rgb(face)
    dll $dll.path(mdx) SetColor $dname 2 text $rgb(0,0,0)
  }
  if ($devent == sclick) {
    if ($did == 38) {
      var %action = $gettok($did($dname,38),1,32)
      if (%action == size) {
        var %w = $dialog($dname).cw,%h = $dialog($dname).ch
        dll $dll.path(mdx) MoveControl $dname 1 * * $calc(%w - 2) $calc(%h - 27) 
        dll $dll.path(mdx) MoveControl $dname 2 * $calc(%h - 19)  %w *
      }
    }
  }
  if ($devent == menu) {
    if ($did == 4) {
      if (!$isdir(%mpdir)) { set %mpdir C:\ }
      var %wmp $sfile( $+ %mpdir $+ ,Wähle eine Mediadatei aus:,Play)
      if (%wmp != $null) { 
        set %mpdir $nofile(%wmp)
        write -c $shortfn($scriptdirmcMP.htm)
        writeparams 
        write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn(%wmp) $+ ">
        write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
        sc_start $dname 2 270 l 70 Dateiname: $nopath(%wmp) - Größe: ( $+ $bytes($file($shortfn(%wmp)).size).suf $+ ) - Ort: ( $+ $nofile(%wmp) $+ )
        var %hwnd = $dll($dll.path(html),item,$dialog($dname).hwnd id:1)
        var %v = $dll($dll.path(html),attach,%hwnd)
        dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
        msg.file
      }
      else { halt }
    }
    if ($did == 5) { add.mwfile }
    if ($did == 7) { set.mwdir }
    if ($did == 8) { add.mwdir }
    if ($did == 10) { dialog -c $dname }
    if ($did == 14) { mwlist d | set %mwlistdesk 1 }
    if ($did == 15) { mwlist | unset %mwlistdesk }
    if ($did == 16) { mw.cls }
    if ($did == 19) { set %mtdialog -1 | res.list }
    if ($did == 20) { set %mtdialog 10 | res.list }
    if ($did == 21) { set %mtdialog 20 | res.list }
    if ($did == 22) { set %mtdialog 30 | res.list }
    if ($did == 23) { set %mtdialog 40 | res.list }
    if ($did == 24) { set %mtdialog 50 | res.list }
    if ($did == 25) { set %mtdialog 60 | res.list }
    if ($did == 28) { set %mtdialog 70 | res.list }
    if ($did == 29) { set %mtdialog 80 | res.list }
    if ($did == 30) { set %mtdialog 90 | res.list }
    if ($did == 31) { set %mtdialog 100 | res.list }
    if ($did == 33) { run $shortfn($scriptdirhelp.htm) }
    if ($did == 34) { run $shortfn($scriptdirreadme.txt) }
    if ($did == 36) { run mailto:bandy1967@hotmail.com?subject=Windows Media Player } 
    if ($did == 37) { run http://www.bandyscript.de }
    if ($did == 27) { run sndvol32.exe }
  }
  if ($devent == close) {
    write -c $shortfn($scriptdirmcMP.htm) | write $shortfn($scriptdirmcMP.htm) <body bgcolor="#000000" topmargin="0" leftmargin="0"></body> 
    var %hwnd = $dll($dll.path(html),item,$dialog($dname).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    $+(.timersc_,$dname,*) off
  }
}

alias -l res.list { 
  if ($dialog(mediaplyl)) { dialog -x mediaplyl } 
  if (%mwlistdesk == 1) { mwlist d } | else { mwlist }
}


alias -l mw.cls { 
  if ($exists($shortfn($scriptdirmediaplaylist.html))) { 
    if ( $+ $input(HTML Playliste soll gelöscht werden?,200,Hinweis) == $true) {
      .remove $shortfn($scriptdirmediaplaylist.html)
      if ($dialog(mediaplyl)) {
        did -b mediaplyl 13
        did -b mediaplyl 14 
        did -b mediaplyl 16
      }
    }
  }
  write -c $shortfn($scriptdirmcMP.dat) 
  if ($dialog(mediaplyl)) did -r mediaplyl 1
  unset %wmp.no
}

alias -l add.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto adddir }
  else {
    :adddir
    set %mpdir $$sdir( $+ %mpdir $+ ,Welcher Pfad soll hinzugefügt werden)
    if (%mpdir != $null) {
      find.file
      mwlist
      MediaPlist
    }
  }
}

alias -l set.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto setdir }
  else {
    :setdir
    set %mpdir $$sdir( $+ %mpdir $+ ,Wähle den Mediaordner aus)
    if (%mpdir != $null) {
      write -c $shortfn($scriptdirmcMP.dat)
      find.file
      mwlist
      MediaPlist
    }
  }
}

alias -l add.mwfile {
  if (!$isdir(%mpdir)) { set %mpdir C:\ }
  var %wmp $sfile( $+ %mpdir $+ ,Welche Datei soll hinzugefügt werden:,Add)
  if (%wmp != $null) {
    set %mpdir $nofile(%wmp)
    write $shortfn($scriptdirmcMP.dat) %wmp
    mwlist
    MediaPlist
  }
  else { halt }
}

alias -l del.mwfile {  
  if ($did(mediaplyl,1).sel == $null) {
    halt
  }
  else {
    var %mfile $did(mediaplyl,1).sel
    if (%mfile == %wmp.no) { dialog -c mediaplyr }
    write -dl $+ $calc(%mfile - 1) $shortfn($scriptdirmcMP.dat)
    MediaPlist
    if (%mfile < %wmp.no) {
      set %wmp.no $calc(%wmp.no -1)
      did -c mediaplyl 1 %wmp.no
    } 
  }
}

alias -l send.mwfile {
  var %wmp.no $did(mediaplyl,1).sel
  dcc send $$?="Wer soll die Mediadatei gesendet bekommen:" $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1)))
}

alias -l stoplay {
  write -c $shortfn($scriptdirmcMP.htm) | write $shortfn($scriptdirmcMP.htm) <body bgcolor="#000000" topmargin="0" leftmargin="0"></body> 
  var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
  var %v = $dll($dll.path(html),attach,%hwnd)
  dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
  $+(.timersc_,mediaplyr,*) off
  sc_start mediaplyr 2 270 l 70 Willkommen im Windows Media Player
}

alias -l popplay {
  if (!$dialog(mediaplyr)) mwplayer
  write -c $shortfn($scriptdirmcMP.htm)
  set %wmp.no $did(mediaplyl,1).sel
  writeparams 
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) $+ $+ ">
  write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
  sc_start mediaplyr 2 270 l 70 Dateiname: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) - Größe: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) - Ort: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) $+ ) 
  var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
  var %v = $dll($dll.path(html),attach,%hwnd)
  dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
  msg.file
}

alias -l prev.file {
  var %prev.mp3 $calc($calc(%wmp.no - %wmp.no) +1)
  if ($calc(%wmp.no -1) <= %prev.mp3) || ($did(mediaplyl,1).sel == $null) {
    halt
  }
  else { 
    if (!$dialog(mediaplyr)) mwplayer 
    set %wmp.no $calc(%wmp.no - 1) 
    did -c mediaplyl 1 %wmp.no
    write -c $shortfn($scriptdirmcMP.htm)
    writeparams 
    write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ">
    write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
    sc_start mediaplyr 2 270 l 70 Dateiname: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) - Größe: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))).size).suf $+ ) - Ort: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ) 
    var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    msg.file
  }
}

alias -l next.file {
  if ($did(mediaplyl,1).lines == %wmp.no) || ($did(mediaplyl,1).sel == $null) {
    halt
  } 
  else {  
    if (!$dialog(mediaplyr)) mwplayer 
    set %wmp.no $calc(%wmp.no +1)
    did -c mediaplyl 1 %wmp.no
    write -c $shortfn($scriptdirmcMP.htm)
    writeparams 
    write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ">
    write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
    sc_start mediaplyr 2 270 l 70 Dateiname: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) - Größe: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))).size).suf $+ ) - Ort: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ) 
    var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    msg.file
  }
}

alias -l msg.file {
  if ($status == connected) {
    if (%msg.mwfile == 1) {
      .msg $color(info) -a Windows Media Player ** Spielt aktuell: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) ** Größe: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) $+ 
    }
    elseif (%msg.mwfile == 2) {
      .amsg $color(info) Windows Media Player ** Spielt aktuell: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) ** Größe: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) $+
    }
  }
}

alias -l MediaPlist { 
  did -r  mediaplyl 1
  if (%convert2html == 1) {
    write -c $shortfn($scriptdirmediaplaylist.html)
    write $shortfn($scriptdirmediaplaylist.html) <title>HTML Playliste - Windows Media Player</title>
    write $shortfn($scriptdirmediaplaylist.html) <body background=" $+ $scriptdiricons/bg.gif $+ " text="#000000">
    write $shortfn($scriptdirmediaplaylist.html) <center><font face="tahoma" size="2pt"><b>HTML Playliste - Windows Media Player $+ <br>
    if ($me == $null) { write $shortfn($scriptdirmediaplaylist.html) Erstellt von:</b> Kein Nick $+ <br> } | else { write $shortfn($scriptdirmediaplaylist.html) Erstellt von:</b> $me $+ <br> }
    write $shortfn($scriptdirmediaplaylist.html) <b>Datum:</b> $date(mmmm d) $+ , $date(yyyy) <b>Uhrzeit:</b> $time(hh:nn:ss tt) $+ </center><br>
    write $shortfn($scriptdirmediaplaylist.html) <ol>
  }
  var %x = 1
  while (%x < $calc($lines($shortfn($scriptdirmcMP.dat)) + 1)) {
    did -a mediaplyl 1 $remove($nopath($read($shortfn($scriptdirmcMP.dat),%x)),.mpg ,.mpeg ,.avi ,.asf ,.mov ,.wmv ,.mp3 ,.mp4 ,.swf $+ ) $chr(9) $bytes($file($read($shortfn($scriptdirmcMP.dat),%x)).size).suf
    if (%convert2html == 1) {
      write $shortfn($scriptdirmediaplaylist.html) <li>Dateiname: <b><u> $+ $nopath($read($shortfn($scriptdirmcMP.dat),%x)) $+ </u></b> <b>-</b> Größe: <b><u> $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),%x)).size).suf $+ </u></b> <b>-</b> Ort: <b><u> $+ $nofile($read($shortfn($scriptdirmcMP.dat),%x)) $+ </u></b></li>
    }    
    inc %x
  }
  if ($exists($shortfn($scriptdirmediaplaylist.html))) && (%convert2html == 1) {
    run $shortfn($scriptdirmediaplaylist.html)
  } 
  unset %convert2html
  did -c mediaplyl 1 %wmp.no
}

alias -l find.file {
  var %x = $findfile(%mpdir,*.swf,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.avi,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wmv,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.asf,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wma,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mpeg,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mpg,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mp3,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mid,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wav,0,write $shortfn($scriptdirmcMP.dat) $1-)
}

alias -l writeparams {
  write $shortfn($scriptdirmcMP.htm) <html> <head> <title>Windows Media Player</title> </head>
  write $shortfn($scriptdirmcMP.htm) <body topmargin="0" leftmargin="0">
  write $shortfn($scriptdirmcMP.htm) <OBJECT classid="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A" height="100%" id="WindowsMediaPlayer" style="LEFT: 0px; TOP: 0px"  width="100%" VIEWASTEXT>
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="ShowControls" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="ShowTracker" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="EnableTracker" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FullScreenMode" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="AutoStart" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="AutoRewind" VALUE="1">
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="Enabled" VALUE="1">
}


alias -l sc_start {
  var %r return,%e echo $color(info) -ea * /sc_start:,%c did -r $1-2
  if $isid { %e incorrect usage | %r }
  if !$5 { %e insufficient parameters | %r }
  if !$dialog($1) { %e no such dialog | %r }
  if $4 != l && $4 != r { %e invalid direction | %r }
  var %x $timer(0)
  while %x { 
    if $+(sc_,$1,_,$2,_*) iswm $timer(%x) { .timer $+ $ifmatch off | %c | break }
    dec %x
  }
  var %a did -a $1-2,%n $+($iif($4 = l,$6-),$chr(160),$iif($3 > $len($6-),$str($chr(160),$calc($3 - $len($6-)))),$iif($4 = r,$6-)),%x 1
  %a %n
  while %x <= $len(%n) {
    $+(.timersc_,$1,_,$2,_,%x) -m 1 $calc($5*%x) %c $chr(124) %a $right(%n,$iif($4 = l,-) $+ %x) $+ $left(%n,$iif($4 = r,-) $+ %x) $iif(!$calc($len(%n)-%x),$chr(124) sc_start $1-)
    inc %x
  }
}

alias -l pop tokenize 32 $dll($dll.path(popup),Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)

alias -l dll.path {
  if ($1 == mdx) return $shortfn($mircdirdll\mdx.dll)
  elseif ($1 == html) return $shortfn($mircdirdll\nHTMLn_2.95.dll)
  elseif ($1 == popup) return $shortfn($mircdirdll\popups.dll)
  elseif ($1 == tdialog) return $shortfn($mircdirdll\tdialog.dll)
}

alias -l views return $shortfn($mircdirdll\views.mdx)

alias -l bars return $shortfn($mircdirdll\bars.mdx)

alias -l dialogs return $shortfn($mircdirdll\dialog.mdx)

alias -l setmdx {
  dll $dll.path(mdx) SetMircVersion $version
  dll $dll.path(mdx) MarkDialog $dname $dialog($dname).hwnd
}

;* Windows Media Player Ende

;* Control-Panel

alias etl echo -at ::: $1-
alias nid cfg misc icondir $$sdir($left($mircdirsys\icons,3),- Wähle den neuen Iconpfad aus)
alias d if (!$1) return | elseif (!$dialog($1)) dialog -m $1 $1
alias cfg .writeini -n $scriptdirconfig.ini $$1 $$2 $3-
alias _cfg return $readini $scriptdirconfig.ini $$1 $$2
alias popdll return $mircdirdll\popups.dll
alias mdx if ($lock(dll)) return | if ($isid) return $dll($mdx.udll,$1,$iif($2- != $null,$2-,.)) | dll $shortfn($mdx.udll) $1-
alias mdx.udll return $mircdirdll\mdx.dll
alias mdx.vdll return $mircdirdll\views.mdx
alias mdx.bdll return $mircdirdll\bars.mdx
alias mdx.ddll return $mircdirdll\dialog.mdx
alias mdx.set mdx SetDialog $dname $1-
alias movecontrol mdx MoveControl $dname $1-
alias headersizes did -i $dname $1 1 header $2-
alias new.menu dll $popdll New $1-
alias popup.destroy dll $popdll Destroy $$1
alias popup.newitem dll $popdll AddItem $$1-
alias popup tokenize 32 $dll($popdll,Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)
alias mdx.start {
  mdx MarkDialog $dname
  mdx SetMircVersion $version
  var %a = 1,%x = 0
  while (%a <= 205) {
    var %b = $dll($mdx.udll,SetFont,$dname %a + 12 400 tahoma)
    if (ERROR isin %b) { inc %x }
    if (%x == 6) { break }
    inc %a
  }
}
alias tab {
  if ($1- == $null) return $chr(9)
  var %list
  var %a = 1
  while ( $ [ $+ [ %a ] ] != $null ) {
    set %list $instok(%list, $ [ $+ [ %a ] ] ,0,9)
    inc %a
  }
  return %list
}
alias cp d cp
alias cpeditor d cpeditor
alias cpabout d about
dialog cp {
  title Control Panel %bsver
  size -1 -1 223 133
  option dbu
  button "Ende",1,2 120 30 10, cancel
  list 2, 2 2 220 100, size hide
  list 3, 2 2 220 100, size hide
  list 4, 2 2 220 100, size hide
  list 5, 2 102 220 15, size
}
alias refresh.panel {
  did -r $dname 2,3,4 | did -i $dname 2,3,4 1 clearicons list
  var %b = $calc($lines($scriptdirpanel.txt) +2) | var %a = $mdx(SetControlMDX,2 listview autoarange flatsb icon > [ $mdx.vdll ] ),%a = $mdx(SetControlMDX,3 listview autoarange flatsb smallicon > [ $mdx.vdll ] ),%a = $mdx(SetControlMDX,4 listview report flatsb grid noheader > [ $mdx.vdll ] )
  headersizes 4 @150,300 | var %a = 1 | while $read($scriptdirpanel.txt,%a) { var %b = $read($scriptdirpanel.txt,%a) | did -i $dname 2,3,4 1 seticon %a, $+ $gettok(%b,1,9) | did -i $dname 5 1 seticon list %a, $+ $gettok(%b,1,9) | did -a $dname 2,3 %a $gettok(%b,2,9) | did -a $dname 4 %a $gettok(%b,2,9) $chr(9) $gettok(%b,3,9) | inc %a }
  did -i $dname 5 2 0 $tab($lines($scriptdirpanel.txt) Object(s) Loaded,Control Panel)
}
alias editing.panel { dialog -c $dname | cpeditor }
alias large.view { did -h $dname 3,4 | did -v $dname 2 | cfg misc panelview large | did -i $dname 5 2 0 $tab($calc($did($dname,2).lines -1) Object(s) Loaded,Control Panel) }
alias small.view { did -h $dname 2,4 | did -v $dname 3 | cfg misc panelview small | did -i $dname 5 2 0 $tab($calc($did($dname,3).lines -1) Object(s) Loaded,Control Panel) }
alias details.view { did -h $dname 2,3 | did -v $dname 4 | cfg misc panelview details | did -i $dname 5 2 0 $tab($calc($did($dname,4).lines -1) Object(s) Loaded,Control Panel) }
on *:dialog:cp:*:*:{
  if ($devent == init) {
    mdx.start | mdx.set icon $scriptdiricons\02.ico | mdx.set style border title sysmenu minbox
    var %a = $mdx(SetControlMDX,2 listview autoarange flatsb icon > [ $mdx.vdll ] ),%a = $mdx(SetControlMDX,3 listview autoarange flatsb smallicon > [ $mdx.vdll ] ),%a = $mdx(SetControlMDX,4 listview report flatsb grid noheader > [ $mdx.vdll ] ),%a = $mdx(SetControlMDX,5 statusbar > [ $mdx.bdll ] ),%a = $mdx(SetBorderStyle,5 windowedge),%a $mdx(SetControlMDX,6 positioner size maxbox minbox > [ $mdx.ddll ] )
    headersizes 4 @150,300 $tab(0 T1,T2) | var %a = 1 | while $read($scriptdirpanel.txt,%a) { var %b = $read($scriptdirpanel.txt,%a) | did -i $dname 2,3,4 1 seticon %a, $+ $gettok(%b,1,9) | did -i $dname 5 1 seticon list %a, $+ $gettok(%b,1,9) | did -a $dname 2,3 %a $gettok(%b,2,9) | did -a $dname 4 %a $gettok(%b,2,9) $chr(9) $gettok(%b,3,9) | inc %a }
    did -i $dname 5 2 0 $tab($lines($scriptdirpanel.txt) Object(s) Loaded,Control Panel)
    if ($_cfg(misc,panelview) == large) { did -h $dname 3,4 | did -v $dname 2 }
    if ($_cfg(misc,panelview) == small) { did -h $dname 2,4 | did -v $dname 3 }
    if ($_cfg(misc,panelview) == details) { did -h $dname 2,3 | did -v $dname 4 }
  }
  if ($devent == sclick) {
    if ($did isnum 2-4) { var %a = $gettok($read($scriptdirpanel.txt,$calc($did($dname,$did).sel - 1)),2,9) | if (%a) did -i $dname 5 2 $calc($did($dname,$did).sel - 1) $tab(%a,%a) }
    if ($did isnum 2-4) {
      if ($gettok($did($dname,$did,1),1,32) != rclick) || ($did($did).seltext != $null) halt
      new.menu cp 0 8
      new.menu cp.view 10 10
      popup.newitem cp end +> 1 1 Views $cr cp.view
      $iif($_cfg(misc,panelview) == large,popup.newitem cp.view end +x 0 0 Large Icons,popup.newitem cp.view end + 0 0 Large Icons $cr large.view)
      $iif($_cfg(misc,panelview) == small,popup.newitem cp.view end +x 0 0 Small Icons,popup.newitem cp.view end + 0 0 Small Icons $cr small.view)
      $iif($_cfg(misc,panelview) == details,popup.newitem cp.view end +x 0 0 Details,popup.newitem cp.view end + 0 0 Details $cr details.view)
      popup.newitem cp end
      popup.newitem cp end 2 2 Refresh $cr refresh.panel
      popup.newitem cp end 3 3 Panel Editor $cr editing.panel
      popup.newitem cp end
      popup.newitem cp end 4 4 Beenden $cr dialog -c $dname
      popup cp $mouse.dx $mouse.dy
    }
    if ($did == 6) {
      var %a = $gettok($did($dname,6),1,32)
      if (%a == size) {
        var %w = $dialog($dname).cw,%h = $dialog($dname).ch
        movecontrol 2 * * $calc(%w -4) $calc(%h -23)
        movecontrol 3 * * $calc(%w -4) $calc(%h -23)
        movecontrol 4 * * $calc(%w -4) $calc(%h -23)
        movecontrol 5 * $calc(%h -21) $calc(%w -3) *
      }
    }
  }
  if ($devent == dclick) {
    if ($did isnum 2-4) if ($gettok($read($scriptdirpanel.txt,$calc($did($dname,$did).sel - 1)),3,9)) { $ifmatch }
  }
}
alias paneledit did -r $dname 2 | did -i $dname 2 1 clearicons main | var %a = 1 | while $read($scriptdirpanel.txt,%a) { var %b = $read($scriptdirpanel.txt,%a) | did -i $dname 2 1 seticon %a, $+ $gettok(%b,1,9) | did -a $dname 2 %a $tab($gettok(%b,2,9),$gettok(%b,3,9)) | inc %a }
alias clearpanel write -c $scriptdirpanel.txt | paneledit
alias remitem if ($did($dname,2).sel) write -dl $+ $calc($ifmatch - 1) $scriptdirpanel.txt | paneledit
alias additem var %a = $$?="Bezeichnung:",%b = $$?="Befehl:",%c = $$sfile($_cfg(misc,icondir) $+ \*.ico,Wähle ein Icon,Select) | write $scriptdirpanel.txt $remove(%c,$mircdir) $+ $chr(9) $+ %a $+ $chr(9) $+ %b | did -i $dname 2 1 seticon $did($dname,2).lines, $+ %c | did -a $dname 2 $did($dname,2).lines $tab(%a,%b)
dialog cpeditor {
  title Control Panel Editor
  size -1 -1 200 113
  option dbu
  button Okay,1, 148 88 50 23, cancel
  list 2, 2 5 196 80, size
}
on *:dialog:cpeditor:*:*:{
  if ($devent == init) {
    mdx.start | mdx.set icon $scriptdiricons\02.ico
    var %a = $mdx(SetControlMDX,2 listview showsel report grid rowselect hottrack flatsb nosortheader single alignleft > [ $mdx.vdll ] ), %a = $mdx(SetBorderStyle,1 clientedge) > [ $mdx.bdll ] )
    headersizes 2 @150,126 $tab(Caption,Command) | paneledit
  }
  if ($devent == sclick) {
    if ($did == 2) {
      if ($gettok($did($dname,2,1),1,32) != rclick) halt
      new.menu cp 0 8
      popup.newitem cp end 1 1 Add $cr additem
      if ($did(2).sel) popup.newitem cp end 2 2 Remove $cr remitem
      popup.newitem cp end
      popup.newitem cp end 3 3 Clear $cr clearpanel
      popup.newitem cp end 4 4 Refresh $cr paneledit
      popup.newitem cp end
      popup.newitem cp end 5 5 Exit $cr dialog -c $dname
      popup cp $mouse.dx $mouse.dy
    }
  }
}
dialog about {
  title Über %bsver
  size -1 -1 166 128
  button "Okay",1, 112 100 50 23, ok
  box "" 2, 4 1 157 93
  box "" 3, 10 49 144 8
  icon 4,2 95 32 32, $scriptdiricons\01.ico
  text %bsver,15,5 20 150 15, center
  text Author: Bandy,16,5 35 150 15, center
}
on *:dialog:about:init:0:{ mdx.start | mdx.set icon $scriptdiricons\01.ico | var %a = $mdx(SetBorderStyle,1 clientedge) > [ $mdx.bdll ] ) }

;* Control Panel Ende

;* Explorer
alias search.error { dialog -m search.error search.error }
alias -l tutup.exp {
  did -r dsearch 1
  dialog -x cari.dir cari.dir
  dir.search
}
alias -l mdx.search { return $+(",$mircdirdll\mdx.dll,") }
alias -l ddll.search { return $mircdirdll\dialog.mdx }
alias -l html.search { return $+(",$mircdirdll\nHTMLn_2.95.dll,") }
alias -l dir.about { $iif(!$dialog(about.dsearch),dialog -m about.dsearch about.dsearch) }
alias explorer { set %dirsearch c:\ | $iif(!$dialog(dsearch),dialog -m dsearch dsearch) }
alias -l dir.search {
  dll $html.search attach $dll($html.search,item,$dialog($dname).hwnd id:1)
  dll $html.search navigate $+(file://,%dirsearch)
}
dialog dsearch {
  title Win Explorer %bsver
  size -1 -1 480 370
  option dbu
  icon icons\search.ico
  list 1, 3 5 250 150,size
  button "o&k", 2, 183 171 37 12, hide cancel
  menu "&Datei", 10
  item "&Exit", 11, 10
  menu "&Optionen", 20
  item "&Zurück", 23, 20
  item "&Vor",24,20
  item "break", 25,20
  item "&Wechsel Pfad",26,20
  ;menu "&Help", 30
  ;item "&Leer", 21, 30
  ;item "&Leer", 22, 30
  button "positioner", 3,10 10 10 10,hide
}

dialog cari.dir {
  title Pfadeingabe - %bsver
  size -1 -1 107 45
  option dbu
  icon icons\search.ico 
  text "Pfadeingabe ( Beispiel: d:\ )", 1, 5 5 141 25
  edit " ", 2, 5 15 96 10
  button "&Ok", 3, 75 30 30 12, default
}
dialog search.error {
  title Fehler - %bsver
  size -1 -1 187 75
  icon icons\search.ico 
  icon 4, 8 8 57 75, " $+ $scriptdiricons\error.ico $+ "
  text "Der Pfad muss so lauten :\ z.B. c:\", 1, 39 15 141 25, center
  box "", 2, 10 80 170 8
  button "Ok", 3, 63 47 65 20, ok
}
on *:dialog:dsearch:menu:*:{
  if ($did == 11) { dialog -x dsearch }
  if ($did == 21) { run $+(",$scriptdirreadme.txt,") }
  if ($did == 22) { dir.about }
  if ($did == 23) { dll $html.search back 0 }
  if ($did == 24) { dll $html.search forward 0 }
  if ($did == 26) { $iif(!$dialog(cari.dir),dialog -m cari.dir cari.dir) }
}
on *:dialog:dsearch:init:*:{
  dll $mdx.search SetMircVersion $version 
  dll $mdx.search MarkDialog $dname
  dll $mdx.search SetControlMDX  $dname 3 positioner maxbox minbox size > $ddll.search
  dir.search
}
on *:dialog:dsearch:sclick:3:{
  var %action = $gettok($did($dname,3),1,32)
  if (%action == size) {
    var %w = $dialog($dname).cw,%h = $dialog($dname).ch
    dll $mdx.search MoveControl $dname 1 * * $calc(%w -13) $calc(%h -14) 
  }
}
on *:dialog:cari.dir:edit:*:{ if ($did == 2) set %dirsearch $did(2).text }
on *:dialog:cari.dir:sclick:3:{
  if (*:\* iswm %dirsearch) tutup.exp
  else search.error
}

on *:dialog:dsearch:close:*: unset %dirsearch 

;* Explorer Ende
;* Exploit mirc 6.1 bis 6.16 schliessen
on *:LOAD:scid -a exploit.fix
on *:START:scid -a exploit.fix
on ^*:LOGON:*:{ exploit.fix }
alias exploit.fix {
  .debug -i NUL mirc6.x.fix
}
alias mirc6.x.fix {
  tokenize 32 $1
  if ($1 == <-) && ($3 == INVITE) && ($chr(36) isin $5) { 
    set -u2 %nick $right($gettok($2,1,33),-1)
    echo 4 -ae *** Möglicher Angreifer gefunden: %nick
    .ignore -iu2 %nick
    notice %nick bIRC-Script %bsver hat diesen Angriff erfolgreich geblockt.
    haltdef
  }
  else return
}
;* Exploit mirc 6.1 bis 6.16 schliessen Ende

;* TeamSpeak
on *:LOAD:{ 
  if ($version < 6.03) {
    .unload -rs tsquery.mrc
    echo -ts Teamspeak Query Bot benötigt mind. mIRC v6.03 oder neuer.
  }
  else { /echo -a mIRC Teamspeak Query Bot wurde erfolgreich geladen }
}

on $*:TEXT:/^[!@.]addalias/i:*:{
  var %alias $2
  var %ip $3
  if ((%alias != $null) && (%ip != $null)) {
    .writeini $scriptdirquery.ini tsquery %alias %ip
    /msg $chan $nick  $+ %alias %ip $+  hinzugefügt in tsquery $+ $chr(46)
  }
}

;-----------------------------------------------------------------------------
; Begin TS Server Query
;-----------------------------------------------------------------------------

on $*:text:/^[!@.]ts/i:#:{
  $tsquery($chan,$2)
}

on $*:text:/^[!@.]ts/i:?:{
  $tsquery($nick,$2)
}

on *:input:#:{ 
  if ($1 == !ts) { 
    $tsquery($chan,$2)
  }
  else if ($1 == !addalias) {
    var %alias $2
    var %ip $3
    if ((%alias != $null) && (%ip != $null)) {
      .writeini $scriptdirquery.ini tsquery %alias %ip
      /msg $chan $nick  $+ %alias %ip $+  hinzugefügt in tsquery $+ $chr(46)
    }
  }
}

on *:input:?:{ 
  if ($1 == !ts) { 
    $tsquery($nick,$2)
  }
  else if ($1 == !addalias) {
    var %alias $2
    var %ip $3
    if ((%alias != $null) && (%ip != $null)) {
      .writeini $scriptdirquery.ini tsquery %alias %ip
      /msg $nick  $+ %alias %ip $+  hinzugefügt in tsquery $+ $chr(46)
    }
  }
}

alias -l tsquery {
  if (($2 != $null) && ($chr(46) !isin $2)) {
    if ($readini($scriptdirquery.ini,tsquery,$2) != $null) { 
      var %server $readini($scriptdirquery.ini,tsquery,$2)
      ; %server --> 67.18.198.30:9000
      var %sockserver $1 $+ $chr(174) $+ %server
      ; %sockserver --> nick®67.18.198.30:9000
      sockclose ts. [ $+ [ %sockserver ] ]
      unset %ts. [ $+ [ %sockserver ] ]
      unset %pl. [ $+ [ %sockserver ] ]
      sockopen -tk ts. [ $+ [ %sockserver ] ] $gettok(%server,1,58) 51234
    }
    else if (server* iswm $2) {
      $gettsservers($1)
    }
    else {
      /msg $1  Bitte gebe die richtige IP oder den richtigen Befehl an. Schreibe: "!ts servers" für die Anzeige der Serverliste. 
    }
  }
  else if (($2 != $null) && ($gettok($2,2,58) != $null)) {
    var %sockserver $1 $+ $chr(174) $+ $2 $gettok($2,1,58) 51234
    ; %sockserver --> nick®67.18.198.30:9000
    sockclose ts. [ $+ [ %sockserver ] ]
    unset %ts. [ $+ [ %sockserver ] ]
    unset %pl. [ $+ [ %sockserver ] ]
    sockopen -tk ts. [ $+ [ %sockserver ] ]
  }
  else if ($2 != $null) {
    /msg $1  TS FEHLER: Die Port Nummer fehlt. 
    /msg $1  Beispiel: !ts ts1.dsservers.com:8767 
  }
  else { /msg $1  Bitte gebe die richtige IP oder den richtigen Befehl an. Schreibe: "!ts servers" für die Anzeige der Serverliste.  }
}

on *:SOCKOPEN:ts.*:{
  sockwrite -n $sockname si $gettok($sockname,2,58)
}

on *:SOCKOPEN:pl.*:{
  sockwrite -n $sockname pl $gettok($sockname,2,58)
}

on *:SOCKREAD:ts.*: {
  if ($sockerr > 0) { return }
  var %tmp | var %maxusers | var %tmpserv $gettok($sockname,2-,46) | var %tmpchan $gettok($gettok($sockname,2-,46),1,174)
  sockread %tmp
  while ($sockbr) {
    if (%tmp == [TS]) { sockread %tmp }
    else if (%tmp == OK) { sockclose $sockname }
    else if (server_name=* iswm %tmp) {
      set %ts. [ $+ [ %tmpserv ] ] $gettok(%tmp,2,61)
    }
    else if (server_maxusers=* iswm %tmp) {
      set %maxusers $chr(47) $+ $gettok(%tmp,2,61) $+ $chr(41)
    }
    else if (server_currentusers=* iswm %tmp) {
      set %ts. [ $+ [ %tmpserv ] ] %ts. [ $+ [ %tmpserv ] ] $+ $chr(32) $+ $chr(40) $+ $gettok(%tmp,2,61) $+ %maxusers
      /msg %tmpchan TS Server: $gettok(%tmpserv,2,174) %ts. [ $+ [ %tmpserv ] ]
      sockclose pl. [ $+ [ %tmpserv ] ]
      sockopen -tk pl. [ $+ [ %tmpserv ] ] $gettok($gettok(%tmpserv,1,58),2,174) 51234
      sockclose $sockname
      break
    }
    sockread %tmp
  }
}

on *:SOCKREAD:pl.*: {
  if ($sockerr > 0) { return }
  var %tmp | var %tmpchan $gettok($gettok($sockname,2-,46),1,174)
  sockread %tmp
  while ($sockbr) {
    if (%tmp == [TS]) { sockread %tmp }
    else if (%tmp == OK) { tspost $gettok($sockname,2-,46) | break }
    else {
      if ($len( % [ $+ [ $sockname ] ] ) < 400 ) {
        set % [ $+ [ $sockname ] ] % [ $+ [ $sockname ] ] $replace($gettok(%tmp,15,9) $+ $chr(32) , nick, $null)
      }
      else {
        /msg %tmpchan Users connected: % [ $+ [ $sockname ] ]
        set % [ $+ [ $sockname ] ] $replace($gettok(%tmp,15,9) $+ $chr(32) , nick, $null)
      }
    }
    sockread %tmp
  }
}

alias tspost {
  sockclose *. [ $+ [ $1- ] ]
  if (%pl. [ $+ [ $1 ] ] == $chr(32)) { 
    unset %ts. [ $+ [ $1 ] ]
    unset %pl. [ $+ [ $1 ] ]
    return
  }
  /msg $gettok($1,1,174)  Users connected: %pl. [ $+ [ $1 ] ]
  unset %ts. [ $+ [ $1 ] ]
  unset %pl. [ $+ [ $1 ] ]
}

alias -l gettsservers {
  var %i 0
  var %list
  while (%i <= $ini($scriptdirquery.ini,tsquery,0)) {
    var %ini $ini($scriptdirquery.ini,tsquery,[ %i ])
    if ($gettok($readini($scriptdirquery.ini,tsquery,[ %ini ]),1,58)) {
      set %list %list %ini    
    }
    inc %i
  }
  /msg $1 TS Servers: %list
}
;* TeamSpeak Ende
;* Google
on *:TEXT:*:#: { if ($_ban($+($nick,!,$address))) && ($_trigger($1)) { _input $chan $cid $nick $2- } }
on *:INPUT:#: { if ($_trigger($1)) { _input $chan $cid $nick $2- } }
on *:SOCKOPEN:_google.*: {
  tokenize 32 $sock($sockname).mark
  sockwrite -nt $sockname GET $+(/search?hl=en&q=,$_encode($6-),&num=,$4,&btnG=Search&meta=) HTTP/1.1
  sockwrite -nt $sockname Accept-Language: en-us
  sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
  sockwrite -nt $sockname Referer: http://www.google.com
  sockwrite -nt $sockname Host: www.google.com
  sockwrite -nt $sockname Connection: keep-alive
  sockwrite -t $sockname $str($crlf,2)
}
on *:SOCKREAD:_google.*: {
  if ($sockerr > 0) return
  :nextread
  sockread &x
  if ($sockbr == 0) return
  if ($bvar(&x, 1, 7).text == HTTP/1.) {
    var %r $bvar(&x, 1, $calc($bfind(&x, 1, $cr) - 1)).text
    if ($gettok(%r, 2, 32) != 200) && ($gettok(%r, 2, 32) != 302) {
      _hadd $sockname error %r
      _parse $sockname error $sock($sockname).mark
      sockclose $sockname
      return
    }
  }
  hadd -mbu300 $sockname $_item($sockname) &x
  if ($bfind(&x, 1, </html>)) { var %sn $sockname, %sm $sock(%sn).mark | sockclose $sockname | _main %sn %sm | return }
  goto nextread
}
on *:SOCKCLOSE:_google.*: { _main $sockname $sock($sockname).mark | return }

;
; Main HTML Parsing Alias
;
alias -l _main {
  var %i 1, %sn $1
  bunset &x
  while ($hget(%sn,%i).item) {
    .echo -q $hget(%sn,%i,&x.d)
    bcopy &x $calc($bvar(&x,0) + 1) &x.d 1 $bvar(&x.d,0)
    inc %i
  }
  bunset &x.d
  if ($hget(%sn)) { hfree %sn }
  if ($bvar(&x,0) == 0) {
    _hadd %sn error No data received on socket!
    _parse %sn error $2-
    sockclose %sn
    return
  }
  tokenize 32 $2-
  var %p = $bfind(&x, 1, <font size=-1>Results)
  .echo -q $regex(one, $remove($bvar(&x, %p, 500).text, $cr, $lf), <font size=-1>Results .*? of about <b>(.[^ ]*)</b>.*?\((.*?) second.*?\)&nbsp;</font>)
  if ($5 == 1) {
    _hadd %sn results $_regexp($regml(one, 1))
    _hadd %sn time $_regexp($regml(one, 2))
    _parse %sn info $1-
  }

  var %i 1, %m $_ini(set, max)
  while (%i <= %m) {
    var %p = $calc($bfind(&x, %p, <!--m-->) + 1)
    if ($regex(one, $remove($bvar(&x, %p, 400).text, $cr, $lf), <a .*?href="(.*?)".*?>(.*?)</a>)) {
      var %p = $calc($bfind(&x, %p, <font size=-1>))
      if (!$regex(four, $remove($bvar(&x, %p, 800).text, $cr, $lf), <font size=-1>(.*?)<nobr>)) { continue }
      var %t = $regml(four, 1), %desc n/a, %size n/a, %date
      if (</font> isin %t) {
        if ($mid(%t, 2, 12) == - [ <a href=) { var %p = $bfind(&x, $calc(%p + 1), <font size=-1>) }
        .echo -q $regex(two, $remove($bvar(&x, %p, 800).text, $cr, $lf), (.*?)<font color=#008000>(.*?)</font>)
        .echo -q $regex(three, $regml(two, 2),.*? - (.*?) - (.*?) -)
        var %desc $_regexp($regml(two, 1))
        var %size $iif($regml(three, 1),$ifmatch,n/a)
        var %date $iif($regml(three, 2),$asctime($ctime($ifmatch),yyyy-mm-dd),n/a)
      }
      _hadd %sn num %i
      _hadd %sn url $regml(one, 1)
      _hadd %sn title $_regexp($regml(one, 2))
      _hadd %sn desc %desc
      _hadd %sn size %size
      _hadd %sn date %date
      _parse %sn result $1-
    }
    else {
      if (%i == 1) { _parse %sn none $1- }
      break
    }
    inc %i
  }
}

;
; Main Input Alias
;
alias -l _input {
  if (!$_chan($1)) || (!$_ini(set, online)) { return }
  var %l 1, %i 1, %c 0
  while (%i <= $calc($0 - 3)) {
    var %m = $gettok($4-,%i,32)
    if (($left(%m,2) iswm -l) && ($right(%m,-2) > 0)) { var %l $right(%m,-2) }
    elseif (%m == -i) { var %c 1 }
    else { break }
    inc %i
  }
  var %t = $gettok($4-, $+(%i,-), 32)
  if (!%t) {
    _msg $1 $2 $3 3 $decode(Akdvb2dsZSBTZWFyY2ggdjEuOAIgYnkgTWVpaiA8bWVpamllQGdtYWlsLmNvbT4=,m)
    _msg $1 $2 $3 3 $eval($decode(AlVzYWdlAjogJF9pbmkoc2V0LCB0cmlnZ2VyKSBbb3B0aW9uc10gPHNlYXJjaD4=,m),2)
    _msg $1 $2 $3 3 $decode(Ak9wdGlvbnMCOg==,m)
    _msg $1 $2 $3 3 $decode(AiACIAIgAiACIAJMaW1pdCBSZXN1bHRzOiAtbE4gKHdoZXJlIE4gaXMgdGhlIG51bWJlciBvZiByZXN1bHRzIHRvIGxpc3Qp,m)
    _msg $1 $2 $3 3 $decode(AiACIAIgAiACIAJTZWFyY2ggSW5mbzogLWkgKGRpc3BsYXR5cyBzb21lIG1pc2Mgc2VhcmNoIGluZm8gd2l0aCByZXN1bHRzKQ==,m)
    _msg $1 $2 $3 3 $eval($decode(AkV4YW1wbGU6AiAkX2luaShzZXQsIHRyaWdnZXIpIC1pIC1sMTAgbUlSQw==,m),2)
    return
  }
  if ($_ini(set, max) < %l) { var %l $ifmatch }
  ; Format:
  ;  1 = channel the trigger was activated from
  ;  2 = network scid
  ;  3 = nickname of the person who activated it
  ;  4 = how many results to list (1, this is default)
  ;  5 = display misc search info (0 = off, 1 = on)
  ;  6 = search string
  sockmark $_open $1 $2 $3 %l %c %t
}

;
; Queue Aliases
;
alias -l _msg {
  set %queue._google. [ $+ [ $calc($_info(0) + 1) ] ] $1-
  if (!$timer(_google)) { .timer_google -m 0 2000 _say }
}
alias -l _info {
  if ($1 isnum) {
    if (%queue._google. [ $+ [ $1 ] ]) && ($1 > 0) { return %queue._google. [ $+ [ $1 ] ] }
    elseif ($1 == 0) { return $var(%queue._google.*) }
  }
}
alias -l _say {
  var %i 1
  if (%queue._google. [ $+ [ %i ] ]) {
    tokenize 32 %queue._google. [ $+ [ %i ] ]
    scid $2
    if ($3 ison $1) && ($me ison $1) && ($5) {
      if ($4 == 1) { msg $1 $5- }
      elseif ($4 == 2) { .msg $3 $5- }
      else { .notice $3 $5- }
    }
    unset %queue._google. [ $+ [ %i ] ] | var %h $calc(%i + 1)
    while (%queue._google. [ $+ [ %h ] ]) { set %queue._google. [ $+ [ $calc(%h - 1) ] ] %queue._google. [ $+ [ %h ] ] | unset %queue._google. [ $+ [ %h ] ] | inc %h }
  }
  else { .timer_google off }
}

;
; Socket Aliases
;
alias -l _open {
  :name
  var %s = $+(_google.,$md5($ticks))
  if ($sock(%s)) { goto name }
  if ($_ini(set, proxy)) {
    if ($_ini(set, host)) && ($_ini(set, port)) { sockopen %s $_ini(set, host) $_ini(set, port) }
    else { echo -ta [Google] Error: please specify a hostname and port number in the proxy settings }
  }
  else { sockopen %s www.google.com 80 }
  return %s
}

;
; Misc Aliases
;
alias -l _ban {
  var %i 1
  while (%i <= $ini($scriptdirgoogle.set, ban, 0)) {
    var %x = $readini($scriptdirgoogle.set, n, ban, $ini($scriptdirgoogle.set, ban, %i))
    if ($1 isnum) && ($1 == %i) { return %x }
    elseif (%x iswm $1) { return 0 }
    inc %i
  }
  return $iif($1 == 0,$calc(%i - 1), 1)
}
alias -l _item {
  var %i 1
  while ($hget($1,%i).item) { inc %i }
  return %i
}
alias -l _regexp {
  var %i 1, %l quot 34|lt 60|lg 62|amp 38|nbsp 32, %m $1
  while ($regex(regexp, %m, /(&#(\d{1,3});)/s)) { var %m = $replace(%m, $regml(regexp, 1), $chr($regml(regexp, 2))) }
  .echo -q $regsub(%m, /<[^>]+>/g,, %m)
  while (%i <= $gettok(%l,0,124)) {
    var %t = $gettok(%l,%i,124)
    .echo -q $regsub(%m, $+(/&,$gettok(%t,1,32),;/g), $chr($gettok(%t,2,32)), %m)
    inc %i
  }
  .echo -q $regsub(%m, /&[^;]+;/g,, %m)
  return $remove(%m, (show more), (WGA), (more), (view trailer))
}
alias -l _mode { return $iif($_ini(set, msgmode), $ifmatch, 1) }
alias -l _encode {
  var %s, %p = $len($1-)
  while (%p) {
    if ($mid($1-,%p,1) isalnum) { %s = $+($ifmatch,%s) }
    else { %s = $+(%,$base($asc($mid($1-,%p,1)),10,16),%s) }
    dec %p
  }
  return %s
}
alias -l _ini {
  if ($isid) { return $readini($scriptdirgoogle.set, n, $1, $$2) }
  elseif ($3) { writeini $+(",$scriptdir,google.set,") $1 $2 $$3- }
  else { remini $+(",$scriptdir,google.set,") $$1 $2 }
}
alias -l _trigger {
  if ($1 == $_ini(set, trigger)) { return 1 }
  return 0
}
alias -l _chan {
  if ($_ini(set, all)) { return 1 }
  var %i 1, %l $_ini(set, networks)
  while (%i <= $gettok(%l, 0, 44)) {
    var %n = $gettok(%l, %i, 44)
    if (%n == $network) {
      var %j 1
      while (%j <= $gettok($_ini(set, $+(.,%n)), 0, 44)) {
        var %c = $gettok($_ini(set, $+(.,%n)), %j, 44)
        if (%c == $1) { return 1 }
        inc %j
      }
    }
    inc %i
  }
}

;
; Output Parsing Aliases
;
alias -l _mini {
  var %i 1, %l
  while (%i <= $ini($scriptdirgoogle.set, $1, 0)) {
    var %m = $ini($scriptdirgoogle.set, $1, %i)
    if ($iif($3,$3-,*) iswm %m) { var %l = $addtok(%l, %m, 44) }
    inc %i
  }
  var %l = $sorttok(%l, 44)
  return $iif($2 == 0, $gettok(%l, 0, 44), $gettok(%l, $2, 44))
}
alias -l _hadd { hadd -mcu300 $1 $$2 $3- }
alias -l _codes {
  var %i 1, %o $$1-, %r = $+(/&b\^/g 2|/&u\^/g 31|/&o\^/g 15|/&k\^/g 3|/&r\^/g 22)
  while (%i <= $gettok(%r, 0, 124)) {
    var %t = $gettok(%r, %i, 124)
    .echo -q $regsub(%o, $gettok(%t, 1, 32), $iif($gettok(%t, 2, 32) isnum, $chr($ifmatch), $ifmatch), %o)
    inc %i
  }
  return %o
}
alias -l _parse {
  var %i 1, %m $+($2,_*), %s $3-
  _hadd $1 chan $gettok(%s, 1, 32)
  _hadd $1 nick $gettok(%s, 3, 32)
  _hadd $1 limit $gettok(%s, 4, 32)
  _hadd $1 search $gettok(%s, 6-, 32)
  while (%i <= $_mini(outp, 0, %m)) {
    var %e = $_mini(outp, %i, %m), %l = $_codes($_ini(outp, %e)), %j 1, %o %l
    while (%j <= $hget($1, 0).item) {
      .echo -q $regsub(%o, $+(/&,$hget($1, %j).item,\^/g), $hget($1, $hget($1, %j).item), %o)
      inc %j
    }
    inc %i
    if ($regex(%l, /&[^&]*?\^/g) != $regex(%o, /&[^&]*?\^/g)) {
      .echo -q $regsub(%o,/&[^&]*?\^/g,n/a, %o)
      _msg $gettok(%s, 1, 32) $gettok(%s, 2, 32) $gettok(%s, 3, 32) $_mode %o
    }
  }
  if ($hget($1)) { hfree $1 }
}

;
; Dialog Stuff
;
alias _google { if (!$dialog(_google)) { dialog -m _google _google } }
alias -l _cmbload {
  var %i 1
  while (%i <= $gettok($_ini($3, $4),0,44)) {
    did -a $1 $2 $gettok($_ini($3, $4),%i,44)
    inc %i
  }
}
alias -l _cmbsave {
  var %i 1, %j
  while ($did($1,$2,%i).text) {
    var %j = $+($iif(%j,$+(%j,$chr(44))),$did($1,$2,%i).text)
    inc %i
  }
  return %j
}
alias -l _replace { return $replace($$1-, $chr(2), &b^, $chr(31), &u^, $chr(15), &o^, $chr(3), &k^, $chr(22), &r^)) }
dialog _google {
  title "Google Search - Einstellungen [/_google]"
  size -1 -1 190 102
  option dbu
  combo 5, 0 9 60 72, sort size
  combo 1, 61 9 61 72, sort size
  button "Okay", 2, 74 93 37 9, ok cancel
  edit "", 3, 127 37 60 10
  text "Trigger:", 4, 127 30 20 7
  text "Channels", 6, 80 1 23 7
  text "Networks", 7, 18 1 24 7
  button "Add", 8, 61 81 16 9
  button "Rem", 9, 78 81 16 9
  button "Add", 10, 0 81 16 9
  button "Rem", 11, 17 81 16 9
  check "All", 16, 106 81 17 10
  check "An", 15, 128 48 46 9
  combo 12, 127 19 60 43, size drop
  box "Options", 13, 124 6 66 85
  text "Message Mode", 14, 127 12 37 7
  button "Ban Liste", 20, 127 59 60 9
  button "Proxy Optionen", 17, 127 69 60 9
  button "Configure Output", 18, 127 79 60 9
}
dialog _google.proxy {
  title "Google Search - Proxy Settings"
  size -1 -1 164 19
  option dbu
  button "Okay", 1, 62 10 37 9, ok cancel
  text "Host:", 2, 0 1 14 8, right
  edit "", 3, 15 0 102 10
  text "Port:", 4, 118 1 13 8, right
  edit "", 5, 132 0 31 10
  check "An", 6, 133 10 30 9
}
dialog _google.ban {
  title "Google Search - Ban List"
  size -1 -1 190 102
  option dbu
  combo 1, 1 1 188 92, size
  button "Done", 2, 74 93 37 9, ok cancel
  button "Add", 3, 0 93 16 9, default
  button "Rem", 4, 17 93 16 9
}
dialog _google.output {
  title "Google Search - Configure Output"
  size -1 -1 190 102
  option dbu
  edit "", 1, 0 12 190 80, multi return autohs autovs vsbar
  combo 2, 1 1 60 50, size drop
  text "", 3, 136 3 51 8, hide
  button "Done", 4, 74 93 37 9, ok cancel
}
on *:DIALOG:_google:*:*: {
  if ($devent == init) {
    if ($_ini(set, online)) { did -c $dname 15 }
    did -a $dname 12 Channel
    did -a $dname 12 Private
    did -a $dname 12 Notice
    did -c $dname 12 $iif($_ini(set, msgmode),$ifmatch,1)
    did -ra $dname 3 $_ini(set, trigger)
    _cmbload $dname 5 set networks
    if ($_ini(set, all)) { did -c $dname 16 | did -b $dname 1,5,8,9,10,11 }
    else { did -c $dname 5 1 }
    if ($did($dname,5,1).text) {
      _cmbload $dname 1 set . $+ $did($dname,5,1)
    }
  }
  if ($devent == sclick) {
    if ($did == 19) { run $did($dname,19).text }
    if ($did == 17) { if (!$dialog(_google.proxy)) { dialog -ma _google.proxy _google.proxy } }
    if ($did == 20) { if (!$dialog(_google.ban)) { dialog -ma _google.ban _google.ban } }
    if ($did == 18) { if (!$dialog(_google.output)) { dialog -ma _google.output _google.output } }
    if ($did == 12) { _ini set msgmode $did($dname,12).sel }
    if ($did == 15) { _ini set online $did($dname,15).state }
    if ($did == 16) {
      _ini set all $did($dname,16).state
      if ($did($dname,16).state == 1) {
        did -u $dname 5
        did -b $dname 1,5,8,9,10,11
      }
      else {
        did -e $dname 1,5,8,9,10,11
        if ($did($dname,5,1).text) {
          did -c $dname 5 1
          did -r $dname 1
          _cmbload $dname 1 set . $+ $did($dname,5,1)
        }
        did -f $dname 5
      }
    }
    if ($did == 5) && ($did($dname,5).sel isnum) {
      did -r $dname 1
      _cmbload $dname 1 set . $+ $did($dname,5,$did($dname,5).sel)
    }
    if ($did == 10) && (!$did($dname,5).sel) && ($did($dname,5).text) {
      did -a $dname 5 $did($dname,5).text
      did -c $dname 5 $did($dname,5).lines
      _ini set networks $_cmbsave($dname,5)
      did -r $dname 1
      _cmbload $dname 1 set . $+ $did($dname,5).text
      did -f $dname 5
    }
    if ($did == 11) && ($did($dname,5).sel isnum) {
      var %s $did($dname,5).sel
      did -d $dname 5 %s
      _ini set networks $_cmbsave($dname,5)
      did -r $dname 1
      while (%s > 0) {
        if ($did($dname,5,%s).text) {
          did -c $dname 5 %s
          _cmbload $dname 1 set . $+ $did($dname,5,%s)
          break
        }
        dec %s
      }
      did -f $dname 5
    }
    if ($did == 8) && (!$did($dname,1).sel) && ($did($dname,1).text) && ($did($dname,5).seltext) {
      var %t $did($dname,1).text
      did -a $dname 1 $iif($left(%t,1) != $chr(35),$+($chr(35),%t),%t)
      did -c $dname 1 $did($dname,1).lines
      _ini set $+(.,$did($dname,5).seltext) $_cmbsave($dname,1)
      did -f $dname 1
    }
    if ($did == 9) && ($did($dname,1).sel isnum) {
      var %s $did($dname,1).sel
      did -d $dname 1 %s
      _ini set $+(.,$did($dname,5).seltext) $_cmbsave($dname,1)
      while (%s > 0) {
        if ($did($dname,1,%s).text) {
          did -c $dname 1 %s
          break
        }
        dec %s
      }
      did -f $dname 1
    }
  }
  if ($devent == close) {
    if ($did($dname,3).text) { _ini set trigger $iif($gettok($did($dname,3).text, 1, 32),$ifmatch,!google) }
  }
}
on *:DIALOG:_google.proxy:*:*: {
  if ($devent == init) {
    did -a $dname 3 $_ini(set, host)
    did -a $dname 5 $_ini(set, port)
    if (!$_ini(set, proxy)) || (!$_ini(set, host)) || (!$_ini(set, port)) { did -b $dname 3,5 }
    else { did -c $dname 6 }
  }
  elseif ($devent == sclick) {
    if ($did == 6) {
      _ini set proxy $did($dname,6).state
      if ($did($dname,6).state == 1) { did -e $dname 3,5 }
      else { did -b $dname 3,5 }
    }
  }
  elseif ($devent == close) {
    _ini set host $did($dname,3).text
    _ini set port $did($dname,5).text
  }
}
on *:DIALOG:_google.ban:*:*: {
  if ($devent == init) {
    var %i 1
    while (%i <= $_ban(0)) {
      did -a $dname 1 $_ban(%i)
      inc %i
    }
  }
  elseif ($devent == sclick) {
    if ($did == 3) && ($did($dname, 1).text) {
      did -a $dname 1 $did($dname, 1).text
      did -c $dname 1 $did($dname,1).lines
      did -f $dname 1
    }
    if ($did == 4) && ($did($dname, 1).sel) {
      var %s $did($dname, 1).sel
      did -d $dname 1 %s
      while (%s > 0) {
        if ($did($dname,1,%s).text) {
          did -c $dname 1 %s
          break
        }
        dec %s
      }
      did -f $dname 1
    }
    else { did -f $dname 1 }
  }
  elseif ($devent == close) {
    _ini ban
    var %i 1
    while (%i <= $did($dname, 1).lines) {
      _ini ban %i $did($dname, 1, %i)
      inc %i
    }
  }
}
on *:DIALOG:_google.output:*:*: {
  if ($devent == init) {
    did -r $dname 1,2,3
    did -a $dname 2 Result
    did -a $dname 2 Info
    did -a $dname 2 None
    did -a $dname 2 Error
    did -c $dname 2 1
    var %i 1, %n $_mini(outp, 0, result_*)
    while (%i <= %n) {
      var %s = $_mini(outp, %i, result_*)
      var %o = $+(%o,$_ini(outp, %s),$iif(%i != %n,$crlf))
      inc %i
    }
    did -a $dname 1 %o
    did -j $dname 1
    did -c $dname 1 1
    did -a $dname 3 $did($dname, 2).text
  }
  if (($devent == sclick) && ($did == 2) && ($did($dname, 1).edited)) || (($devent == close) && ($did($dname, 1).edited)) {
    var %m = $+($lower($did($dname, 3).text),_*)
    var %i 1
    while (%i <= $_mini(outp, 0, %m)) {
      _ini outp $_mini(outp, %i, %m)
      inc %i
    }
    var %i 1
    while (%i <= $did($dname, 1).lines) {
      var %m = $+($lower($did($dname, 3).text),_,%i)
      var %t = $did($dname, 1, %i).text
      if (%t) {
        _ini outp %m $_replace(%t)
        inc %i
      }
      else { did -d $dname 1 %i }
    }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      did -ra $dname 3 $did($dname, 2).text
      did -r $dname 1
      var %i 1, %n $_mini(outp, 0, $+($did($dname,2).seltext,_*))
      while (%i <= %n) {
        var %s = $_mini(outp, %i, $+($did($dname,2).seltext,_*))
        var %o = $+(%o,$_ini(outp, %s),$iif(%i != %n,$crlf))
        inc %i
      }
      did -a $dname 1 %o
      did -j $dname 1
      did -c $dname 1 1
    }
  }
}
;* Ende Google
;* Google Fight
alias google {
  if (!$2) { echo -a Usage /google WORT WORT | halt }
  set %gogle1 $1 | set %gogle2 $2 | sockopen googlefight www.google.de 80 | msg $active GoogleFight: $1 vs. $2
}
alias google1 { sockopen googlefight1 www.google.de 80 }
on 1:SOCKOPEN:googlefight: {
  if (!$sockerr) {
    sockwrite -n $sockname GET $+(/search?hl=de&q= $+ %gogle1 $+ )/ HTTP/1.1
    sockwrite -n $sockname Host: www.google.de $+ $str($crlf,2)
    sockwrite -n $sockname $crlf
  }
}
on *:SOCKREAD:googlefight: {
  sockread %temp
  if (von ungefähr isin %temp) {
    set %google1 $gettok($gettok(%temp,23,62),1,60) $gettok($gettok(%temp,25,62),1,60)
    sockclose googlefight
    google1 $2
  }
}
on 1:SOCKOPEN:googlefight1: {
  if (!$sockerr) {
    sockwrite -n $sockname GET $+(/search?hl=de&q= $+ %gogle2 $+ )/ HTTP/1.1
    sockwrite -n $sockname Host: www.google.de $+ $str($crlf,2)
    sockwrite -n $sockname $crlf
  }
}
on *:SOCKREAD:googlefight1: {
  sockread %temp
  if (von ungefähr isin %temp) {
    set %google2 $gettok($gettok(%temp,23,62),1,60) $gettok($gettok(%temp,25,62),1,60)
    sockclose googlefight1
    auswertung
  }
}
alias auswertung {
  if ($remove($gettok(%google1,1,32),.) > $remove($gettok(%google2,1,32),.)) { msg $active Googlefight-Auswertung: $gettok(%google1,2,32) $+ : $gettok(%google1,1,32) Treffer! $gettok(%google2,2,32) $+ : $gettok(%google2,1,32) Treffer! | msg $active gewonnen hat $gettok(%google1,2,32) }
  if ($remove($gettok(%google1,1,32),.) < $remove($gettok(%google2,1,32),.)) { msg $active Googlefight-Auswertung: $gettok(%google2,2,32) $+ : $gettok(%google2,1,32) Treffer! $gettok(%google1,2,32) $+ : $gettok(%google1,1,32) Treffer! | msg $active gewonnen hat $gettok(%google2,2,32) }
  unset %google* %gogle* %temp
}
;* Google Fight Ende
