<log manager>
alias logman { if ($dialog(logman)) { dialog -x logman | dialog -m logman logman } | else { dialog -m logman logman } }
dialog logman {
  title "Log Manager - Ms3.1"
  size -1 -1 327 200
  icon images\icone\logs.ico
  tab "Gestione Log", 500,140 60 180 108
  tab "Info Log", 501, 140 60 180 108
  list 2, 10 20 120 140,size
  box "Logs trovati", 10,5 5 130 160
  box "Visualizza in:", 11, 140 5 180 50
  button "@window", 3, 145 25 82 21
  button "Block notes", 4, 232 25 82 21
  button "Rinomina", 5, 152 100 75 21, tab 500
  button "Elimina", 6, 152 125 75 21, tab 500
  button "Copia", 7, 232 100 75 21,tab 500
  button "Aggiorna", 8, 232 125 75 21,tab 500
  box "", 9, 145 85 170 70,tab 500
  icon 12, 10 167 35 35,images/icone/logs.ico
  button "&Chiudi", 13, 155 172 80 21,ok
  button "&Guida >>", 14, 240 172 80 21
  box "",15, 145 85 170 73, tab 501
  text "Nome File", 16, 152 110 50 17,tab 501
  edit "", 17, 210 105 100 18, tab 501, right,read
  text "Dimensione", 18, 152 130 50 17, tab 501
  edit "", 19, 210 125 100 18, tab 501, right,read
  list 20, 333 10 140 170,size
  text "www.mIRCscript.it", 21, 360 182 85 21
}
on *:dialog:logman:*:*:{
  if ($devent == init) {
    mdxbegin |  mdx SetFont 2,3,4,5,6,7,8,13,14,16,17,18,19,20,21 12 400 Tahoma | mdx SetFont 9,10,11 12 700 Tahoma | mdx SetBorderStyle 3,4,5,6,7,8,13,14 staticedge
    unset %log | unset %guidalog
    mdx SetControlMDX 20 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i logman 20 1 headerdims 120:1 | did -i logman 20 1 headertext + 0 Guida all'uso:
    mdx SetControlMDX 2 ListView report rowselect grid showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx 
    did -i logman 2 1 headerdims 97:1 | did -i logman 2 1 headertext + 0 Logs:
    did -r logman 2 | var %logfinder = 0 | while (%logfinder < $findfile(logs\,*.log,0)) { inc %logfinder | did -i logman 2 1 seticon list 0,images/icone/memofile.ico | did -a logman 2 +b 1 $remove($nopath($findfile(logs\,*.log,%logfinder)),.log)  }
    var %rigo = 1 | while $lines(dati\guide\logman.txt) >= %rigo { did -az logman 20 $read -l $+ %rigo dati\guide\logman.txt | inc %rigo } 
  }
  if ($devent == sclick) {
    if ($did == 2) { set %log $mid($did(2).seltext,13) | did -ra logman 17 %log | did -ra logman 19 $calc($file(logs/ $+ %log $+ .log).size /1024) kb  }
    if ($did == 3) {  if (%log != $null) { readlogwin } }
    if ($did == 4) { if (%log != $null) {  run $logdir $+ / $+ $mid($did(2).seltext,13) $+ .log } }
    if ($did == 5) {  if (%log != $null) { renamelog } }
    if ($did == 6) { if (%log) { conferma_dellog } }
    if ($did == 7) {  if (%log != $null) {  copy $logdir $+ %log $+ .log $sdir="Selezionare la cartella di destinazione di %log $+ .log" %log $+ .log } }
    if ($did == 8) { did -r logman 2 | var %logfinder = 0 | while (%logfinder < $findfile(logs\,*.log,0)) { inc %logfinder | did -i logman 2 1 seticon list 0,images/icone/memofile.ico | did -a logman 2 +b 1 $remove($nopath($findfile(logs\,*.log,%logfinder)),.log)  } }
    if ($did == 14) { if (%guidalog) { did -ra logman 14 &Guida >> | guidainlogman } | else { did -ra logman 14 &Guida << | guidaoutlogman } }
  }
  if ($devent == dclick) {
    if ($did == 2) {  if (%log != $null) { readlogwin } }
  }
}
alias guidainlogman { 
  unset %guidalog | var %guidainlogX 477 | :diminuisci 
  if (%guidainlogX > 327) { dialog -s logman -1 -1 %guidainlogX 200 | dec %guidainlogX | goto diminuisci } | else { halt }
}

alias guidaoutlogman { 
  set %guidalog on | var %guidaoutlogX 327 | :incrementa 
  if (%guidaoutlogX < 477) { dialog -s logman -1 -1 %guidaoutlogX 200 | inc %guidaoutlogX | goto incrementa } | else { halt }
}
alias readlogwin { 
  window -aCdo @Log -1 -1 450 300
  loadbuf -p @Log $logdir $+ %log $+ .log
  sline @Log 15 | unset %log
}
alias renamelog {
  set %log.nuovo $?="Inserire nuovo nome file (compresa estensione .log):"
  if (%log.nuovo == $null) { halt }
  else {
    rename $logdir $+ %log $+ .log $logdir $+ %log.nuovo
    did -r logman 2 | var %logfinder = 0 | while (%logfinder < $findfile($logdir $+ \,*.log,0)) { inc %logfinder | did -i logman 2 1 seticon list 0,images/icone/memofile.ico | did -a logman 2 +b 1 $remove($nopath($findfile(logs\,*.log,%logfinder)),.log)  } 
    unset %log
  }
}
alias conferma_dellog { dialog -om dellog dellog }

dialog dellog {
  size -1 -1 180 80
  title "Conferma elimina"
  box "", 5, 5 1 170 75
  text "Si è sicuri di voler cancellare il file:", 1, 10 13 180 21
  text "", 2, 10 25 180 21
  button "Sì",3, 20 50 60 21
  button "No", 4, 100 50 60 21,ok
}
on *:dialog:dellog:*:*:{
  if ($devent == init) {
    mdxbegin | mdx SetFont 1,2,3,4 12 400 Tahoma | mdx SetBorderStyle 3,4 staticedge
    did -ra dellog 2 %log $+ .log ?
  }
  if ($devent == sclick) { 
    if ($did == 3) { remove $logdir $+ %log $+ .log | dialog -x dellog | unset %log 
    did -r logman 2 | var %logfinder = 0 | while (%logfinder < $findfile($logdir $+ \,*.log,0)) { inc %logfinder | did -i logman 2 1 seticon list 0,images/icone/memofile.ico | did -a logman 2 +b 1 $remove($nopath($findfile(logs\,*.log,%logfinder)),.log)  } }
  }
}
menu @Log {
  Chiudi: window -c @Log
}
</log manager>
<invio email>
alias invioemail { if ($dialog(email)) { dialog -x email | dialog -m email email } | else { dialog -m email email } }
dialog email {
  title Invio Email - Ms3.1
  size -1 -1 245 230
  box "Configurazione",1, 5 1 235 100
  text "Mittente:",2, 12 20 40 19
  edit "",3, 75 16 158 19
  text "Destinatario:", 4, 12 40 55 19
  edit "",5, 75 36 158 19
  text "Server Smtp:",6, 12 60 60 19
  edit "",7, 75 56 158 19
  text "Oggetto:",8, 12 80 60 19
  edit "",9, 75 76 158 19
  box "Testo dell'email",10, 5 101 235 100
  edit "", 11, 10 115 225 80, multi return vsbar
  list 15, 245 5 140 200,size
  button "&Invia",12, 50 205 60 19
  button "&Chiudi", 13, 115 205 60 19,ok
  button "&Guida >>", 14, 180 205 60 19
  text "www.mIRCscript.it",16, 270 210 150 19
  icon 99, 10 197 32 32, images/icone/email.ico
}
on *:dialog:email:*:*:{
  if ($devent == init) {
    mdxbegin |  unset %guidaEmail
    mdx SetFont 1,10 12 700 Tahoma | mdx SetFont 2,3,4,5,6,7,8,9,11,12,13,14,15,16 12 400 Tahoma | mdx SetBorderStyle 12,13,14 staticedge
    did -a email 3 %mittente.email | did -a email 7 %smtp.email
    mdx SetControlMDX 15 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i email 15 1 headerdims 120:1 | did -i email 15 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\email.txt) >= %rigo { did -az email 15 $read -l $+ %rigo dati\guide\email.txt | inc %rigo } 
  }
  if ($devent == edit) {
    if ($did == 3) { set %mittente.email $did(email,3) }
    if ($did == 7) { set %smtp.email $did(email,7) }
  }
  if ($devent == sclick) {
    if ($did == 12) {
      if ($did(email,3) == $null) { set %avvertiemail Riempire il campo "Mittente"! | avvertiemail }
      elseif ($did(email,5) == $null) { set %avvertiemail Riempire il campo "Destinatario"! | avvertiemail }
      elseif ($did(email,7) == $null) { set %avvertiemail Riempire il campo "Server Smpt"! | avvertiemail }    
      elseif ($did(email,9) == $null) { set %avvertiemail Riempire il campo "Oggetto"! | avvertiemail }
      elseif ($did(email,11) == $null) { set %avvertiemail Riempire il campo "Testo dell'email"! | avvertiemail }
      else { sockopen smtp $did(email,7) 25 }
    }
    if ($did == 14) { if (%guidaEmail) { did -ra email 14 Guida >> | guidainEmail } | else { did -ra email 14 Guida << | guidaoutEmail } }  
  }
}
on *:sockopen:smtp: { 
  if ($sockerr > 0) { set %avvertiemail Connessione Assente! | avvertiemail | halt }
  dialog -t email Invio in Corso...
  sockwrite -n smtp MAIL FROM: %mittente.email
  sockwrite -n smtp RCPT TO: $did(email,5) 
  sockwrite -n smtp DATA 
} 
on *:sockread:smtp: { 
  if ($sockerr > 0) { set %avvertiemail Connessione Assente! | avvertiemail | halt }
  sockwrite -n smtp Subject: $did(email,9)
  :loop
  inc -u %email.accapo | if (%email.accapo > 120) { goto end }
  sockwrite -n smtp $iif($did(email,11,%email.accapo) != $null,$did(email,11,%email.accapo),$crlf)
  goto loop | :end
  sockwrite -n smtp . 
  sockwrite -n smtp QUIT 
  sockclose smtp
  .timer 1 1 dialog -t email Email Inviata con successo!
} 

alias avvertiemail { dialog -m aemail aemail }
dialog aemail {
  title Invio Email
  size -1 -1 200 70
  box "Attenzione!",1, 5 1 190 40 
  text "", 2, 12 15 180 20
  button "Chiudi", 3, 65 47 70 19,ok
} 
on *:dialog:aemail:init:*:{ mdxbegin | mdx SetFont 1 12 700 Tahoma | mdx SetBorderStyle 3 staticedge | mdx SetFont 2,3 12 400 Tahoma | did -ra aemail 2 %avvertiemail }
alias guidainEmail { 
  unset %guidaEmail | var %guidainEmailX 390 | :diminuisci 
  if (%guidainEmailX > 245) { dialog -s email -1 -1 %guidainEmailX 230 | dec %guidainEmailX | goto diminuisci } | else { halt }
}
alias guidaoutEmail { 
  set %guidaEmail on | var %guidaoutEmailX 245 | :incrementa 
  if (%guidaoutEmailX < 390) { dialog -s email -1 -1 %guidaoutEmailX 230 | inc %guidaoutEmailX | goto incrementa } | else { halt }
}
</invio email>
<autojoin>
alias ajoin { if (!$dialog(autojoin)) { dialog -m autojoin autojoin } | else { dialog -x autojoin | dialog -m autojoin autojoin } }
dialog autojoin {
  title "Autojoin - Ms3.1"
  size -1 -1 270 180 
  list 1, 10 20 120 120, size
  box "Impostazioni", 4, 5 1 260 145
  edit "", 2, 140 20 110 20, multi, return
  button "Add (+)", 3, 140 50 50 20
  button "Rem (-)", 5, 200 50 50 20
  check "Attiva/disattiva", 8, 150 90 100 19
  check "Autojoin su invito", 10, 150 110 100 19
  icon 11, 10 148 35 35, images/icone/ajoin.ico
  button "&Chiudi", 6,115 154 70 21,ok
  button "&Guida >>", 7, 195 154 70 21
  box "", 12, 140 70 110 8
  list 13, 270 5 140 155,size
  text "www.mIRCscript.it", 14, 300 165 150 19
}
on *:dialog:autojoin:*:*:{ 
  if ($devent == init) {
    mdxbegin | mdx SetFont 1,2,3,5,6,7,8,10,13,14 12 400 Tahoma | mdx SetFont 4 12 700 Tahoma | mdx SetBorderStyle 3,5,6,7 staticedge
    mdx SetControlMDX 1 Listview report rowselect icon grid showsel single labeltip headerdrag  > sistema\dlls\views.mdx
    did -i autojoin 1 1 headerdims 100:1 | did -i autojoin 1 1 headertext + 0 Lista canali:
    mdx SetControlMDX 13 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i autojoin 13 1 headerdims 120:1 | did -i autojoin 13 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\autojoin.txt) >= %rigo { did -az autojoin 13 $read -l $+ %rigo dati\guide\autojoin.txt | inc %rigo } 
    caricaautojoin | did -b autojoin 5 | unset %guidaajoin
    if %aj.son == ON did -c autojoin 8
    if %ajinv == ON did -c autojoin 10
  }
  if ($devent == sclick) {
    if ($did == 1) { if ($did(1).sel != $null) { did -e autojoin 5 | did -ra autojoin 2 $read -l $+ $calc($did(1).sel - 1) $mircdirdati\autojoin.txt } }
    if ($did == 3) { write $mircdirdati\autojoin.txt $did(2).text | did -i autojoin 1 1 seticon list 0,images/icone/ajoin2.ico | did -a autojoin 1 +b 1 $did(2).text | did -z autojoin 1 | did -r autojoin 2 }
    if ($did == 5) { write -dl $+ $calc($did(1).sel - 1) $mircdirdati\autojoin.txt | did -d autojoin 1 $did(1).sel  | did -r autojoin 2 | did -b autojoin 5 }
    if ($did == 7) { if (%guidaAjoin) { did -ra autojoin 7 Guida >> | guidainAjoin } | else { did -ra autojoin 7 Guida << | guidaoutAjoin } }  
    if ($did == 8)  { if ($did(8).state == 1) { set %aj.son ON } | else { unset %aj.son } }
    if ($did == 10) {   if ($did(10).state == 1) { set %ajinv on | ajinvite on | halt } | else { unset %ajinv | ajinvite off | halt } }
  }
}
on *:connect: { 
  if (%aj.son == ON) {
    set %ajlnn $lines($mircdirdati\autojoin.txt)  
    set %ajtmp 1 | :aj 
    join $read -l $+ %ajtmp $mircdirdati\autojoin.txt | inc %ajtmp 
    if (%ajtmp <= %ajlnn) goto aj
  }
}
alias caricaautojoin {
  var %i = 1 | while $lines(dati/autojoin.txt) >= %i { did -i autojoin 1 1 seticon list 0,images/icone/ajoin2.ico | did -a autojoin 1 +b 1 $read(dati/autojoin.txt,%i) | inc %i } 
}
alias guidainAjoin { 
  unset %guidaAjoin | var %guidainAjoinX 420 | :diminuisci 
  if (%guidainAjoinX > 270) { dialog -s autojoin -1 -1 %guidainAjoinX 180 | dec %guidainAjoinX | goto diminuisci } | else { halt }
}
alias guidaoutAjoin { 
  set %guidaAjoin on | var %guidaoutAjoinX 270 | :incrementa 
  if (%guidaoutAjoinX < 420) { dialog -s autojoin -1 -1 %guidaoutAjoinX 180 | inc %guidaoutAjoinX | goto incrementa } | else { halt }
}
</autojoin>
<promemoria>
alias memo { if ($dialog(memo)) { dialog -x memo | dialog -m memo memo } | else { dialog -m memo memo } }
dialog memo {
  title "Promemoria - Ms3.1"
  size -1 -1 280 232
  box "Aggiungi promemoria",2, 5 5 270 70
  text "Giorno:", 3, 10 27 50 19
  combo 4, 50 22 40 75,drop,size
  text "Mese:", 5, 100 27 50 19
  combo 6, 130 22 72 75,drop, size
  text "Ricordare che:",7, 10 51 90 19
  edit "", 8, 80 47 190 19
  button "&Aggiungi", 9, 210 22 60 21
  box "Lista promemoria",10, 5 80 270 120
  list 11, 11 95 256 120
  button "&Elimina", 12, 55 206 70 21
  button "&Chiudi", 1, 130 206 70 21,ok
  button "&Guida >>", 14, 205 206 70 21
  icon 13,10 201 32 32, images\icone\promemo.ico
  list 15, 280 10 140 195,size
  text "www.mIRCscript.it", 16, 305 210 150 19
}
on *:dialog:memo:*:*:{
  if ($devent == init) {
    unset %guidamemo | mdxbegin | mdx SetFont 2,10 12 700 Tahoma | mdx SetFont 1,3,4,5,6,7,8,9,11,12,14,15,16 12 400 Tahoma
    mdx SetBorderStyle 1,9,12,14 staticedge
    mdx SetControlMDX 11 listview rowselect showsel grid single headerdrag labeltip report > sistema\dlls\ $+ views.mdx
    did -i memo 11 1 headerdims 55:1 180:2 | did -i memo 11 1 headertext + 0 Data: $+ $chr(9) $+ 0 Ricordarsi che:
    mdx SetControlMDX 15 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i memo 15 1 headerdims 120:1 | did -i memo 15 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\memo.txt) >= %rigo { did -az memo 15 $read -l $+ %rigo dati\guide\memo.txt | inc %rigo } 
    caricamemo
    var %i = 1 | while (%i <= 31) { if (%i < 10) { did -a memo 4 0 $+ %i } | else { did -a memo 4 %i } | inc %i }
    set %mesememo 01 | set %giornomemo 01 | unset %memomsg
    did -a memo 6 Gennaio | did -a memo 6 Febbraio | did -a memo 6 Marzo | did -a memo 6 Aprile | did -a memo 6 Maggio | did -a memo 6 Giugno | did -a memo 6 Luglio | did -a memo 6 Agosto | did -a memo 6 Settembre | did -a memo 6 Ottobre | did -a memo 6 Novembre | did -a memo 6 Dicembre
    did -c memo 4 1 | did -c memo 6 1
  }
  if ($devent == sclick) {
    if ($did == 4) { set %giornomemo $did(memo,4).text }
    if ($did == 6) { set %mesememo $did(memo,6).sel | if (%mesememo < 10) { set %mesememo 0 $+ $did(memo,6).sel } }
    if ($did == 9) { if (%memomsg != $null) { write dati\memo.txt %giornomemo $+ / $+ %mesememo § %memomsg | caricamemo } }
    if ($did == 12) { if ($did(memo,11).sel != $null) { write -dl $+ $calc($did(memo,11).sel - 1) dati\memo.txt | caricamemo } }
    if ($did == 14) { if (%guidaMemo) { did -ra memo 14 Guida >> | guidainMemo } | else { did -ra memo 14 Guida << | guidaoutMemo } }  
  }
  if ($devent == edit) {
    if ($did == 8) { set %memomsg $did(memo,8).text }
  }
}
alias caricamemo { did -r memo 11 | var %i = 1 | while (%i <= $lines(dati\memo.txt)) { did -i memo 11 1 seticon list 0,images/icone/memoo.ico | did -a memo 11 +b 1 $chr(160) $left($read(dati\memo.txt,%i),5) $+ $chr(9) $+ $remove($mid($read(dati\memo.txt,%i),7),§) | inc %i } }
alias memocode { 
  if ($read(dati\memo.txt, w, * $+ $mid($date,1,5) $+ *) != $null) { dialog -m dialogmemonow dialogmemonow }
}
dialog dialogmemonow {
  title "Promemoria - Ms3.1"
  size -1 -1 220 85
  box "",4, 5 1 210 80
  text "", 2, 10 12 200 30,center
  text "", 3, 10 35 200 40,center
  button "Chiudi",1, 75 55 70 21,ok
}
on *:dialog:dialogmemonow:*:*:{
  if ($devent == init) { mdxbegin | mdx SetFont 1,2,3 12 400 Tahoma | mdx SetBorderStyle 1 staticedge | did -ra dialogmemonow 2 Oggi $left($date,5) è una data da ricordare perchè: | did -ra dialogmemonow 3 " $+ $remove($mid($read(dati\memo.txt, w, * $+ $mid($date,1,5) $+ *),7),§) $+ "  }
}
alias guidainMemo { 
  unset %guidaMemo | var %guidainMemoX 425 | :diminuisci 
  if (%guidainMemoX > 280) { dialog -s memo -1 -1 %guidainMemoX 232 | dec %guidainMemoX | goto diminuisci } | else { halt }
}
alias guidaoutMemo { 
  set %guidaMemo on | var %guidaoutMemoX 280 | :incrementa 
  if (%guidaoutMemoX < 425) { dialog -s memo -1 -1 %guidaoutMemoX 232 | inc %guidaoutMemoX | goto incrementa } | else { halt }
}
</promemoria>

<notifylist>
alias notifylist { if (!$dialog(notifylist)) { dialog -m notifylist notifylist } | else { dialog -x notifylist | dialog -m notifylist notifylist  } }
dialog notifylist {
  title "Notify List - Ms3.1"
  size -1 -1 335 174
  box "Lista",1, 5 1 200 140
  list 2, 10 15 190 120,size
  box "Utenti",3, 210 1 120 76
  text "Nick:",4, 215 18 40 15
  edit "", 5, 245 14 80 19,autohs
  text "Note:",6, 215 38 40 15
  edit "", 7, 245 34 80 19,autohs
  button "Add (+)", 8, 215 54 53 19
  button "Rem (-)", 9, 272 54 53 19
  icon 11, 10 142 32 32,images\icone\notify.ico
  box "Preferenze",12, 210 77 120 64
  check "Echo on notify",13, 215 97 90 19
  check "Apri dialog on notify",14, 215 117 110 19
  button "&Guida >>",15, 260 150 70 20
  list 16, 335 5 140 150,size
  text "www.mIRCscript.it", 17, 360 158 150 19
  button "&Chiudi",100,180 150 70 20,ok
}
on *:dialog:notifylist:*:*: {
  if ($devent == init) { 
    mdxbegin
    mdx SetFont 2,4,5,6,7,8,9,13,14,15,16,17,100 12 400 Tahoma
    mdx SetFont 1,3,12 12 700 Tahoma
    mdx SetBorderStyle 8,9,15,100 staticedge
    mdx SetControlMDX 2 ListView report single showsel rowselect grid > sistema\dlls\ $+ views.mdx
    did -i notifylist 2 1 headerdims 70:1 150:2  | did -i notifylist 2 1 headertext + 0 Nick: $+ $chr(9) $+ 0 Note:
    did -i notifylist 2 1 seticon list images/icone/yes.ico | did -i notifylist 2 1 seticon list images/icone/no.ico
    mdx SetControlMDX 16 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i notifylist 16 1 headerdims 120:1 | did -i notifylist 16 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\notifylist.txt) >= %rigo { did -az notifylist 16 $read -l $+ %rigo dati\guide\notifylist.txt | inc %rigo } 
    if (%notifyecho) { did -c notifylist 13 }
    if (%popupnotify) { did -c notifylist 14 }
    caricanotify | unset %guidaNot
  }
  if ($devent == sclick) {
    if ($did == 8) { if ($did(5).text != $null) { .notify $did(5).text $did(7).text | .timernotify 1 1 caricanotify | did -r notifylist 5,7 } }  
    if ($did == 9) { if ($did(2).seltext != $null) { .notify -r $gettok($gettok($did(2).seltext,1,9),6,32) | .timernotify 1 1 caricanotify } }
    if ($did == 13) { if ($did(notifylist,13).state == 1) { set %notifyecho on } | else { unset %notifyecho } }
    if ($did == 14) { if ($did(notifylist,14).state == 1) { set %popupnotify on } | else { unset %popupnotify } }
    if ($did == 15) { if (%guidaNot) { did -ra $dname 15 Guida >> | guidainnotify } | else { did -ra $dname 15 Guida << | guidaoutnotify } }  
  }
}
alias caricanotify { 
  did -r notifylist 2 
  var %a = 1,%b = 1 | while ($notify(%a)) { if ($notify(%a).ison) did -a notifylist 2 +b 1 $notify(%a)  $+ $chr(9) $+ $notify(%a).note | inc %a } | while ($notify(%b)) { if (!$notify(%b).ison) did -a notifylist 2 +b 2 $notify(%b)  $+ $chr(9) $+ $notify(%b).note | inc %b }
}
alias guidainnotify { 
  unset %guidanot | var %guidainnotX 480 | :diminuisci 
  if (%guidainnotX > 335) { dialog -s notifylist -1 -1 %guidainnotX 174 | dec %guidainnotX | goto diminuisci } | else { halt }
}

alias guidaoutnotify { 
  set %guidanot on | var %guidaoutnotX 335 | :incrementa 
  if (%guidaoutnotX < 480) { dialog -s notifylist -1 -1 %guidaoutnotX 174 | inc %guidaoutnotX | goto incrementa } | else { halt }
}
</notifylist>

<password>
alias password {  if (!$dialog(pass)) { dialog -m pass pass } | else { dialog -x pass | dialog -m pass pass } }
dialog pass {
  size -1 -1 200 115
  title "Password Locker"
  box "Imposta password",1, 5 1 190 57
  text "Password:",2, 10 20 50 19
  edit "", 3, 95 15 90 19,password
  text "Ridigita Password:",4, 10 40 82 19
  edit "", 5, 95 35 90 19,password
  check "Abilita protezione con password", 6,5 60 170 20
  icon 15, 5 82 32 32,images/icone/password.ico
  button "&Chiudi",100, 100 90 95 20
  button "ok", 102, 1 1 1 1,hide,ok
}
on *:dialog:pass:*:*: {
  if ($devent == init) {
    mdxbegin
    mdx SetFont 1 12 700 Tahoma
    mdx SetFont 100,2,3,4,5,6 12 400 Tahoma
    mdx SetBorderStyle 100 staticedge
    did -ra pass 3 %pass | did -ra pass 5 %pass2
    if (%askpass) { did -c pass 6 }
  }
  if ($devent == edit) {
    if ($did == 3) { set %pass.temp $did(3).text }
    if ($did == 5) { set %pass.temp2 $did(5).text }
  }
  if ($devent == sclick) {
    if ($did == 6) { if ($did(pass,6).state == 1) { set %askpass on } | else { unset %askpass } }
    if ($did == 100) {  if (%pass.temp != %pass.temp2) { did -r pass 3,5 | echo $colour(info) -a %prefisso la password non corrisponde alla sua ridigitazione } | else { set %pass %pass.temp | set %pass2 %pass | dialog -x pass } }
  }
}
</password>

<Word Replacer>
alias word {  if (!$dialog(word)) { dialog -m word word } | else { dialog -x word | dialog -m word word } }
dialog word {
  title "Word Replacer - Ms3.1"
  size -1 -1 290 190
  box "Lista",1, 5 1 280 140
  list 2, 10 15 270 120,size
  check "Abilita word replacer",4, 5 143 140 19
  button "Add (+)", 8, 40 165 50 20
  button "Rem (-)", 9, 95 165 50 20
  icon 11, 5 160 32 32,images\icone\spell.ico
  list 12, 290 6 140 160,size
  text "www.mIRCscript.it", 13, 320 170 150 19
  button "&Guida >>",15, 220 165 65 20
  button "&Chiudi",100,150 165 65 20,ok
}
on *:dialog:word:*:*: {
  if ($devent == init) {
    mdxbegin | mdx SetFont 2,4,8,9,12,13,15,100 12 400 Tahoma | mdx SetFont 1 12 700 Tahoma | mdx SetBorderStyle 8,9,15,100 staticedge
    mdx SetControlMDX 2 ListView report single showsel rowselect grid > sistema\dlls\ $+ views.mdx
    did -i word 2 1 headerdims 125:1 125:2 | did -i word 2 1 headertext + 0 Parola/e: $+ $chr(9) $+ 0 Sostituire con:
    caricaword | unset %guidaWord
    mdx SetControlMDX 12 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i $dname 12 1 headerdims 120:1 | did -i $dname 12 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\wordreplacer.txt) >= %rigo { did -az $dname 12 $read -l $+ %rigo dati\guide\wordreplacer.txt | inc %rigo } 
    if (%replword) { did -c word 4 }
  }
  if ($devent == sclick) {
    if ($did == 4) { if ($did(word,4).state == 1) { set %replword on } | else { unset %replword } }
    if ($did == 8) {   
      set %word.temp $$?="Parola da sostituire?"  | %word.temp2 = $$?="Sostituire %word.temp con?"   
      if (%word.temp) && (%word.temp2) { write sistema\word.txt %word.temp $+ $chr(0172) $+ %word.temp2 | unset %word.tem* | caricaword }
    }
    if ($did == 9) { if ($did(word,2).sel != $null) { write -dl $+ $calc($did(word,2).sel - 1) sistema\word.txt | caricaword } }
    if ($did == 15) { if (%guidaWord) { did -ra $dname 15 &Guida >> | guidainWord } | else { did -ra $dname 15 &Guida << | guidaoutWord } }
  }
}
alias guidainWord { 
  unset %guidaWord | var %guidainWordX 435 | :diminuisci 
  if (%guidainWordX > 290) { dialog -s word -1 -1 %guidainWordX 190 | dec %guidainWordX | goto diminuisci } | else { halt }
}
alias guidaoutWord { 
  set %guidaWord on | var %guidaoutWordX 290 | :incrementa 
  if (%guidaoutWordX < 435) { dialog -s word -1 -1 %guidaoutWordX 190 | inc %guidaoutWordX | goto incrementa } | else { halt }
}
alias caricaword { did -r word 2 | var %i = 1 | while (%i <= $lines(sistema\word.txt)) { did -i word 2 1 seticon list 0,images/icone/input.ico | did -a word 2 +b 1 $gettok($read(sistema\word.txt,%i),1,0172)  $+ $chr(9) $+ $gettok($read(sistema\word.txt,%i),2,0172) | inc %i } }
alias wordreplacer { 
  if (%replword == $null) { return $1- | halt }
  set %rigoword 1 | :uffa
  if ($lines(sistema\word.txt) >= %rigoword) {
    if ($gettok($read(sistema\word.txt,%rigoword),1,0172) isin $1-) { return $textspecial($replace($1-,$gettok($read(sistema\word.txt,%rigoword),1,0172),$gettok($read(sistema\word.txt,%rigoword),2,0172))) } | else { inc %rigoword | goto uffa }
  }
  else return $textspecial($1-)
}
</Word Replacer>

<User List>
alias userlist { if ($dialog(ulist)) { dialog -x ulist | dialog -m ulist ulist } | else { dialog -m ulist ulist } }
dialog ulist {
  size -1 -1 300 182
  title "Gestione Liste Utenti"
  box "Lista", 1, 5 1 290 150
  list 2,10 15 280 130,size
  button "Add (+)",3, 50 157 55 20
  button "Rem (-)", 4, 110 157 55 20
  list 5, 300 6 140 154,size
  icon 98, 10 152 32 32,images/icone/userlist.ico
  text "www.mIRCscript.it", 6, 327 165 150 19
  button "&Chiudi",99, 180 157 55 20,ok
  button "&Guida >>",100, 240 157 55 20
}
on *:dialog:ulist:*:*: {
  if ($devent == init) {
    mdxbegin | mdx SetFont 1 12 700 Tahoma
    mdx SetFont 2,3,4,5,6,99,100 12 400 Tahoma | mdx SetBorderStyle 3,4,99,100 staticedge
    unset %guidaUser
    mdx SetControlMDX 5 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i $dname 5 1 headerdims 120:1 | did -i $dname 5 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\userlist.txt) >= %rigo { did -az $dname 5 $read -l $+ %rigo dati\guide\userlist.txt | inc %rigo } 
    mdx SetControlMDX 2 listview rowselect showsel grid single headerdrag labeltip report > sistema\dlls\ $+ views.mdx
    did -i ulist 2 1 headerdims 100:1 70:2 150:3 | did -i ulist 2 1 headertext + 0 Hostmask: $+ $chr(9) $+ 0 Livello: $+ $chr(9) $+ Canali/Flag: 
    caricauserlist  
  }
  if ($devent == sclick) {
    if ($did == 2) { set %userselected $calc($did(ulist,2).sel - 1) }
    if ($did == 3) { adduserlist }
    if ($did == 4) { if ($did(ulist,2).sel != $null) { remuserlist } }
    if ($did == 100) { if (%guidaUser) { did -ra $dname 100 &Guida >> | guidainUser } | else { did -ra $dname 100 &Guida << | guidaoutUser } }
  }
}
alias guidainUser { 
  unset %guidaUser | var %guidainUserX 445 | :diminuisci 
  if (%guidainUserX > 300) { dialog -s ulist -1 -1 %guidainUserX 182 | dec %guidainUserX | goto diminuisci } | else { halt }
}
alias guidaoutUser { 
  set %guidaUser on | var %guidaoutUserX 300 | :incrementa 
  if (%guidaoutUserX < 445) { dialog -s ulist -1 -1 %guidaoutUserX 182 | inc %guidaoutUserX | goto incrementa } | else { halt }
}
alias remuserlist {
  set %varaop $calc(%varaop - 1)
  set %varavoice $calc(%varavoice - 1)
  set %varprotect $calc(%varprotect - 1)
  set %varignore $calc(%varignore - 1)
  if (%userselected <= %varaop) { aop -rw $aop(%userselected) | caricauserlist | halt }
  if (%userselected > %varaop) && ($calc(%userselected - %varaop) <= %varavoice) { avoice -rw $avoice($calc(%userselected - %varaop)) | caricauserlist | halt }
  if (%userselected > %varavoice) && ($calc(%userselected - %varaop - %varavoice) <= %varprotect) { protect -rw $protect($calc(%userselected - %varaop - %varavoice)) | caricauserlist | halt  }
  if (%userselected > %varprotect) && ($calc(%userselected - %varaop - %varavoice - %varprotect) <= %varignore) { ignore -rw $ignore($calc(%userselected - %varaop - %varavoice - %varprotect)) | caricauserlist | halt }
}
alias adduserlist { dialog -m adduser adduser }
dialog adduser {
  size -1 -1 200 110
  title "Aggiungi un utente"
  box "Nuovo utente",1, 5 1 190 105
  text "Hostmask:", 2,12 20 50 19
  edit "",3, 60 15 120 19, autohs
  text "Canali:",4, 12 40 50 19
  edit "", 5,60 35 120 19
  text "Lista:",6,12 60 50 19
  combo 7, 60 55 120 50, drop,size
  button "Add (+)",100, 35 80 60 20
  button "Annulla",101, 105 80 60 20,ok
}
on *:dialog:adduser:*:*: {
  if ($devent == init) {
    mdxbegin
    mdx SetFont 1 12 700 Tahoma
    mdx SetFont 2,3,4,5,6,7,100,101 12 400 Tahoma
    mdx SetBorderStyle 100,101 staticedge
    did -ra adduser 7 AutoOp | did -a adduser 7 AutoVoice | did -a adduser 7 Protect | did -a adduser 7 Ignore | did -c Adduser 7 1
    set %commandlist aop
  }
  if ($devent == sclick) {
    if ($did == 7) { 
      if ($did(adduser,7).text == autoop) { set %commandlist op | did -e $dname 5 }
      if ($did(adduser,7).text == autovoice) { set %commandlist avoice | did -e $dname 5 }
      if ($did(adduser,7).text == protect) { set %commandlist protect | did -e $dname 5 }
      if ($did(adduser,7).text == ignore) { set %commandlist ignore | did -b $dname 5 }
    }
    if ($did == 100) { 
    if ($did(3).text != $null) { %commandlist -w $did(3).text $did(5).text | dialog -x adduser | caricauserlist  } } 
  }
}
alias caricauserlist { 
  did -r ulist 2 
  set %varaop 1 | while $aop(0) >= %varaop {  did -a ulist 2 +b 1 $aop(%varaop) $+ $chr(9) $+ AutoOp $+ $chr(9) $+ $iif($aop(%varaop).type,$aop(%varaop).type,Tutti) | inc %varaop }
  set %varavoice 1 | while $avoice(0) >= %varavoice {  did -a ulist 2 +b 1 $avoice(%varavoice) $+ $chr(9) $+ AutoVoice $+ $chr(9) $+ $iif($avoice(%varavoice).type,$avoice(%varavoice).type,Tutti) | inc %varavoice }
  set %varprotect 1 | while $protect(0) >= %varprotect {  did -a ulist 2 +b 1 $protect(%varprotect) $+ $chr(9) $+ Protect $+ $chr(9) $+ $iif($protect(%varprotect).type,$protect(%varprotect).type,Tutti) | inc %varprotect }
  set %varignore 1 | while $ignore(0) >= %varignore {  did -a ulist 2 +b 1 $ignore(%varignore) $+ $chr(9) $+ Ignore $+ $chr(9) $+ $iif($ignore(%varignore).type,$ignore(%varignore).type,Tutti) | inc %varignore }
}


</User List>
alias messaggi { dialog -m messaggi messaggi }

dialog messaggi {
  title Setup Messaggi Automatici - [Ms3.1]
  size -1 -1 350 298
  tab "Messaggi su Eventi", 500, 1 1 347 297
  tab "Risposte ai Ctcp", 501, 1 1 347 297
  box "On Join/On Part", 2, 5 30 340 100,tab 500
  check "Saluto on Join",1, 15 55 80 12,tab 500
  edit "", 38, 100 50 235 21,autohs, tab 500
  check "On Join", 3, 15 80 60 12,tab 500
  combo 4, 75 75 55 70,drop,size,tab 500
  edit "", 5, 135 75 200 21,autohs,tab 500
  check "On Part", 6, 15 105 60 12,tab 500
  combo 7, 75 100 55 70,drop,size,tab 500
  edit "", 8, 135 100 200 21,autohs,tab 500
  box "On Op/deop/voice/devoice", 9,5 135 340 125,tab 500
  check "On Op", 10, 15 160 60 12,tab 500
  edit "", 12, 100 155 235 21,autohs,tab 500
  check "On Voice", 13, 15 185 60 12,tab 500
  edit "", 15, 100 180 235 21,autohs,tab 500
  check "On Deop", 16, 15 210 60 12,tab 500
  edit "", 18, 100 205 235 21,autohs,tab 500
  check "On Devoice", 19, 15 235 70 12,tab 500
  edit "", 21, 100 230 235 21,autohs,tab 500
  button "Chiudi", 22, 180 266 70 21,ok
  button "Guida >>", 23, 260 266 70 21
  list 24, 355 20 140 250,size
  icon 25, 10 260 35 31, images/icone/automsg.ico
  text "www.mIRCscript.it", 26, 380 275 85 21 

  box "Ctcp Classici", 27, 5 30 340 100,tab 501
  check "Ping", 28, 15 55 60 12,tab 501
  edit "", 29, 100 50 235 21,autohs,tab 501
  check "Time", 30, 15 80 60 12,tab 501
  edit "", 31, 100 75 235 21,autohs,tab 501
  check "Finger", 32, 15 105 60 12,tab 501
  edit "", 33, 100 100 235 21,autohs,tab 501
  box "Ctcp", 34, 5 135 340 125,tab 501
  check "In Uso", 35, 15 160 50 12, tab 501
  edit "", 36, 70 155 265 21,autohs,tab 501
  list 37, 20 180 310 68, size,vsbar,tab 501
}

on *:dialog:messaggi:*:*:{
  if ($devent == sclick) {
    if ($did == 1) { if ($did(messaggi,1).state == 1) { set %saluto on | did -e messaggi 38 } | else { unset %saluto | did -b messaggi 38 } }
    if ($did == 23) { if (%guidamsg) { did -ra messaggi 23 Guida >> | guidainmsg } | else { did -ra messaggi 23 Guida << | guidaoutmsg } }
    if ($did == 3) { if ($did(messaggi,3).state == 1) { set %msgonjoin on | did -e messaggi 4,5 } | else { unset %msgonjoin | did -b messaggi 4,5 } }
    if ($did == 4) { set %tipoonjoin $did(messaggi,4).text }
    if ($did == 6) { if ($did(messaggi,6).state == 1) { set %msgonpart on | did -e messaggi 7,8 } | else { unset %msgonpart | did -b messaggi 7,8 } }
    if ($did == 7) { set %tipoonpart $did(messaggi,7).text }
    if ($did == 10) { if ($did(messaggi,10).state == 1) { set %msgonop on | did -e messaggi 12 } | else { unset %msgonop | did -b messaggi 12 } }
    if ($did == 13) { if ($did(messaggi,13).state == 1) { set %msgonvoice on | did -e messaggi 15 } | else { unset %msgonvoice | did -b messaggi 15 } }
    if ($did == 16) { if ($did(messaggi,16).state == 1) { set %msgondeop on | did -e messaggi 18 } | else { unset %msgondeop | did -b messaggi 18 } }
    if ($did == 19) { if ($did(messaggi,19).state == 1) { set %msgondevoice on | did -e messaggi 21 } | else { unset %msgondevoice | did -b messaggi 21 } }
    if ($did == 28) { if ($did(messaggi,28).state == 1) { set %msgping on | did -e messaggi 29 } | else { unset %msgping | did -b messaggi 29 } }
    if ($did == 30) { if ($did(messaggi,30).state == 1) { set %msgtime on | did -e messaggi 31 } | else { unset %msgtime | did -b messaggi 31 } }
    if ($did == 32) { if ($did(messaggi,32).state == 1) { set %msgfinger on | did -e messaggi 33 } | else { unset %msgfinger | did -b messaggi 33 } }
    if ($did == 35) { if ($did(messaggi,35).state == 1) { set %msgversion on | did -e messaggi 36,37 } | else { unset %msgversion | did -b messaggi 36,37 } }
    if ($did == 37) { did -ra messaggi 36 $did(messaggi,37).seltext | set %MS3version $did(messaggi,37).seltext }
  }
  if ($devent == init) {
    mdxbegin
    mdx SetFont 1,3,4,5,6,7,8,10,12,13,15,16,18,19,21,22,23,24,26,28,29,30,31,32,33,35,36,37,38 12 400 Tahoma
    mdx SetFont 2,9,27,34 12 700 Tahoma
    mdx SetBorderStyle 2,9,22,23,27,34 staticedge
    mdx SetControlMDX 24 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i messaggi 24 1 headerdims 120:1 | did -i messaggi 24 1 headertext + 0 Guida all'uso:

    if (%saluto) { did -c messaggi 1 } | else { did -b messaggi 38 }
    if (%msgonjoin) { did -c messaggi 3 } | else { did -b messaggi 4,5 }
    if (%tipoonjoin == msg) { did -a messaggi 4 msg | did -a messaggi 4 notice | did -c messaggi 4 1 }
    if (%tipoonjoin == notice) { did -a messaggi 4 notice | did -a messaggi 4 msg | did -c messaggi 4 1 }
    if (%msgonjointext != $null) { did -ra messaggi 5 %msgonjointext }
    if (%msgonpart) { did -c messaggi 6 } | else { did -b messaggi 7,8 }
    if (%tipoonpart == msg) { did -a messaggi 7 msg | did -a messaggi 7 notice | did -c messaggi 7 1 }
    if (%tipoonpart == notice) { did -a messaggi 7 notice | did -a messaggi 7 msg | did -c messaggi 7 1 }
    if (%msgonparttext != $null) { did -ra messaggi 8 %msgonparttext }
    if (%msgonop) { did -c messaggi 10 } | else { did -b messaggi 12 }
    if (%msgonoptext != $null) { did -ra messaggi 12 %msgonoptext }
    if (%msgonvoice) { did -c messaggi 13 } | else { did -b messaggi 15 }
    if (%msgonvoicetext != $null) { did -ra messaggi 15 %msgonvoicetext }
    if (%msgondeop) { did -c messaggi 16 } | else { did -b messaggi 18 }
    if (%msgondeoptext != $null) { did -ra messaggi 18 %msgondeoptext }
    if (%msgondevoice) { did -c messaggi 19 } | else { did -b messaggi 21 }
    if (%msgondevoicetext != $null) { did -ra messaggi 21 %msgondevoicetext }
    if (%msgping != $null) { did -c messaggi 28 } | else { did -b messaggi 29 }
    if (%msgtime != $null) { did -c messaggi 30 } | else { did -b messaggi 31 }
    if (%msgfinger != $null) { did -c messaggi 32 } | else { did -b messaggi 33 }
    if (%salutotext != $null) { did -ra messaggi 38 %salutotext }
    if (%msgpingtext) { did -ra messaggi 29 %msgpingtext }
    if (%msgtimetext) { did -ra messaggi 31 %msgtimetext }
    if (%msgfingertext) { did -ra messaggi 33 %msgfingertext }
    if (%msgversion != $null) { did -c messaggi 35 } | else { did -b messaggi 36,37 }
    if (%Ms3version) { did -ra messaggi 36 %MS3version }
    var %rigo = 1 | while $lines(dati\guide\messaggi.txt) >= %rigo { did -az messaggi 24 $read -l $+ %rigo dati\guide\messaggi.txt | inc %rigo } 
    var %rigo = 1 | while $lines(dati\version.txt) >= %rigo { did -az messaggi 37 $read -l $+ %rigo dati\version.txt | inc %rigo } 
    unset %guidamsg
  }
  if ($devent == edit) {
    if ($did == 38) { set %salutotext $did(messaggi,38).text }
    if ($did == 5) { set %msgonjointext $did(messaggi,5).text }
    if ($did == 8) { set %msgonparttext $did(messaggi,8).text }
    if ($did == 12) { set %msgonoptext $did(messaggi,12).text }
    if ($did == 15) { set %msgonvoicetext $did(messaggi,15).text }
    if ($did == 18) { set %msgondeoptext $did(messaggi,18).text }
    if ($did == 21) { set %msgondevoicetext $did(messaggi,21).text }
    if ($did == 29) { set %msgpingtext $did(messaggi,29).text }
    if ($did == 31) { set %msgtimetext $did(messaggi,31).text }
    if ($did == 33) { set %msgfingertext $did(messaggi,33).text }
    if ($did == 36) { set %MS3version $did(messaggi,36).text }
  }
}
on 1:JOIN:#:{ 
  if ($nick != $me) && (%msgonjoin) { %tipoonjoin $nick %msgonjointext %script }
  if ($nick == $me) && (%saluto) { say $replace(%salutotext,&chan,$chan) %script }
}
on 1:PART:#:{ 
  if ($nick != $me) && (%msgonpart) { %tipoonpart $nick %msgonparttext %script }
}

;il codice per i messaggi on op/deop/voice/devoice si trova nel code del C.O.M.

ctcp 1:PING:?: if (%msgping) && (%msgpingtext != $null) { notice $nick %msgpingtext %script | halt }
ctcp 1:FINGER:?: if (%msgfinger) && (%msgfingertext != $null) { notice $nick %msgfingertext %script | halt }
ctcp 1:VERSION:?: if (%msgversion) && (%MS3version != $null) { notice $nick %MS3version | halt }
ctcp 1:TIME:?: if (%msgtime == on) && (%msgtimetext != $null) { notice $nick %msgtimetext %script | halt }

alias guidainmsg { 
  unset %guidamsg | var %guidainmsgX 500 | :diminuisci 
  if (%guidainmsgX > 350) { dialog -s messaggi -1 -1 %guidainmsgX 298 | dec %guidainmsgX | goto diminuisci
  }
  else { halt }
}
alias guidaoutmsg { 
  set %guidamsg on | var %guidaoutmsgX 350 | :incrementa 
  if (%guidaoutmsgX < 500) { dialog -s messaggi -1 -1 %guidaoutmsgX 298 | inc %guidaoutmsgX | goto incrementa
  }
  else { halt }
}
<mass message>
alias msgop {
  %i = 0 | %time.msg = 0
  :inc
  inc %i
  if ($opnick(#,%i) == $me) { goto inc }
  inc %time.msg %msg.freq
  if ($opnick(#,%i) != $null) { .timer 1 %time.msg msg $opnick(#,%i) %mass.msg  | goto inc }
  else { halt }
}
alias msgnoop {
  %i = 0 | %time.msg = 0
  :inc
  inc %i
  if ($nick(#,%i) == $me) { goto inc }
  if ($nick(#,%i) isop $chan) { goto inc }
  inc %time.msg %msg.freq
  if ($nick(#,%i) != $null) { .timer 1 %time.msg msg $nick(#,%i) %mass.msg  | goto inc }
  else { halt }
}
alias msgtutti {
  %i = 0 | %time.msg = 0
  :inc
  inc %i
  if ($nick(#,%i) == $me) { goto inc }
  inc %time.msg %msg.freq
  if ($nick(#,%i) != $null) { .timer 1 %time.msg msg $nick(#,%i) %mass.msg  | goto inc }
  else { halt }
}
alias gogo {
  set %rip.msg $$?="Inserisci il Messaggio da Ripetere:"
  set %rip.sec $$?="Ogni quanti Secondi?:"
  msg # %rip.msg
  .timer800 0 %rip.sec msg # %rip.msg
  echo $colour(info) -a %prefisso Il messaggio " $+ %rip.msg $+ " sarà ripetuto ogni " $+ %rip.sec $+ " secondi su # $+ . Per fermare il messaggio ripetuto premere CTRL F4 %pic
  unset %rip.sec %rip.msg
}
</mass message>

<AWAY>
alias diaway { if ($dialog(away)) { dialog -x away | dialog -m away away } | else { dialog -m away away } }
dialog away {
  title "Sistema Away - Ms3.1"
  size -1 -1 300 275
  tab "Generale",500,1 1 298 275
  tab "Preferenze",501, 1 1 298 275
  box "Nick/motivo",24, 5 30 290 60, tab 500
  button "&Chiudi", 1, 140 243 70 21,ok
  text "Nick Away:", 7, 15 48 60 20, tab 500
  edit "", 2, 85 42 78 20, autohs,tab 500
  text "Motivo:", 10, 15 70 60 20, tab 500
  button "Away", 3, 170 42 55 21,tab 500
  button "Torna", 21, 230 42 55 21,tab 500 
  edit "", 4, 85 65 200 20, autohs,tab 500
  box "Logging", 28, 5 95 290 138,tab 500
  edit "", 5, 10 110 280 118, read, multi, return,vsbar,tab 500
  button "C&ancella Log", 22, 65 243 70 21,tab 500 

  button "&Guida >>", 6, 215 243 70 21
  list 25, 305 20 140 230,size

  box "Opzioni generali", 26, 5 30 290 120, tab 501
  box "Auto Away", 27, 5 155 290 80,tab 501
  check "Ripeti messaggio d'away ogni", 8, 20 50 160 12,tab 501
  edit "", 9, 182 46 28 19,tab 501
  check "Avvisa che sei Away se ti inviano un msg in query", 11, 20 70 260 12,tab 501
  check "Vai in Away dopo", 13, 20 175 100 12,tab 501
  edit "", 14, 125 171 28 19,tab 501
  check "Avvisa sempre prima di settarti in Auto Away", 16, 20 195 230 12,tab 501
  check "Auto Away silenzioso (senza informare nei canali)", 17, 20 215 255 12,tab 501
  check "Abilita chimata urgente (Ctcp Page)", 19, 20 90 190 12,tab 501
  check "Torna dall'Away su propria digitazione", 20, 20 110 200 12,tab 501
  check "Chiudi le query durante l'Away", 23, 20 130 170 12,tab 501
  text "minuti", 29, 215 49 50 21, tab 501
  text "minuti di inattività", 30, 155 174 100 21, tab 501
  icon 31, 15 237 40 35, images/icone/away.ico
  text "www.mIRCscript.it", 32, 332 255 90 19
}

;======================= SCLICK, EDIT, INIT =========================================

on *:dialog:away:*:*:{
  if ($devent == init) {
    mdxbegin
    mdx SetFont 24,26,27,28 12 700 Tahoma
    mdx SetFont 2,4,5,7,8,9,10,11,13,14,16,17,19,20,23,29,30,22,1,3,21,6,25,32 12 400 Tahoma
    mdx SetFont 32 12 400 Tahoma
    mdx SetBorderStyle 1,3,6,21,22,26,27,28 staticedge
    mdx SetControlMDX 25 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i away 25 1 headerdims 120:1 | did -i away 25 1 headertext + 0 Guida all'uso:
    if (%awaystatus == on) { did  -b away 3 | did -c away 21 |  did -t away 21 } | else { did -c away 3 | did -b away 21 |   did -t away 3 }
    if (%nickaway != $null) { did -a away 2 %nickaway }
    if (%awaymotivo != $null) { did -a away 4 %awaymotivo }
    if (%ripetiaway) { did -c away 8 } | else { did -b away 9 }
    if (%avvisamsgqueryaway) { did -c away 11 }
    if (%autoaway) { did -c away 13 } | else { did -b away 14 }
    if (%avvisaautoaway) { did -c away 16 }
    if (%awaysilenzioso == on) { did -c away 17 }
    if (%awaypage == on) { did -c away 19 }
    if (%digitazione) { did -c away 20 }
    if (%awaychiudiquery) { did -c away 23 }
    did -a away 9 %ripetiawayMIN
    did -a away 14 %autoawayMIN
    did -r away 5  
    var %rigo = 1 | while $lines(dati\guide\away.txt) >= %rigo { did -az away 25 $read -l $+ %rigo dati\guide\away.txt | inc %rigo } 
    unset %guidaaway
  }
  if ($devent == sclick) {
    if ($did == 3) { if ($server) { did -t away 21 | set %awaystatus on | set %nicknormale $me | nick %nickaway | did -b away 3 | did -e away 21 | .timer 1 2 VAIAWAY | ripetiaway } }
    if ($did == 21) { did -t away 3 | set %awaystatus off | /away | .timeraway off | did -e away 3 | did -b away 21  | .disable #AWAYA | nick %nicknormale | .timer 1 2 ame sono tornato dall'away, lo ero dalle ( %awayinizio ). %pic }
    if ($did == 6) { if (%guidaaway) { did -ra away 6 &Guida >> | guidainaway } | else { did -ra away 6 &Guida << | guidaoutaway } }
    if ($did == 8) { if ($did(away,8).state == 1) { set %ripetiaway on | did -e away 9  } | else { unset %ripetiaway | did -b away 9 } } 
    if ($did == 11) { if ($did(away,11).state == 1) { set %avvisamsgqueryaway on } | else { unset %avvisamsgqueryaway } }
    if ($did == 13) { if ($did(away,13).state == 1) { set %autoaway on | .enable #AWAYIDLE | did -e away 14 } | else { unset %autoaway | .disable #AWAYIDLE | did -b away 14  } }
    if ($did == 16) { if ($did(away,16).state == 1) { set %avvisaautoaway on } | else { unset %avvisaautoaway } }
    if ($did == 17) { if ($did(away,17).state == 1) { set %awaysilenzioso on } | else { set %awaysilenzioso off } }
    if ($did == 19) { if ($did(away,19).state == 1) { set %awaypage on } | else { set %awaypage off } }
    if ($did == 20) { if ($did(away,20).state == 1) { set %digitazione on } | else { unset %digitazione } }
    if ($did == 22) { did -r away 5 }
    if ($did == 23) { if ($did(away,23).state == 1) { set %awaychiudiquery on } | else { unset %awaychiudiquery } }
  }
  if ($devent == edit) {
    if ($did == 2) { set %nickaway $did(away,2).text }
    if ($did == 4) { set %awaymotivo $did(away,4).text }
    if ($did == 9) { set %ripetiawayMIN $did(away,9).text }
    if ($did == 14) { set %autoawayMIN $did(away,14).text }
  }
}
;================================= CODICE VERO E PROPRIO =====================================

alias VAIAWAY {
  if ($server != $null) {
    .enable #AWAYA
    /away %awaymotivo
    %awayinizio = $time  
    ame sono away perchè ( %awaymotivo  ) Page ( $+ %awaypage $+ ) %pic 
  }
}
alias VAIAUTOAWAY {
  .enable #AWAYA
  set %awaymotivo Auto Away
  /away %awaymotivo
  %awayinizio = $time  
  ame sono away perchè ( %awaymotivo  ) Page ( $+ %awaypage $+ ) %pic  
}

#awaya off
on 1:OPEN:?:{
  if (%awaychiudiquery) { /close -m }
}
on *:INPUT:*: { 
  if (%digitazione) { 
    if ($dialog(away) != $null) { did -e away 3 | did -b away 21 }
  set %awaystatus off | .timeraway off | .disable #AWAYA | /away | nick %nicknormale | .timer 1 2 echo $colour(info) -a %prefisso [Info Script] Avendo digitato, non sei più in modalità Away. } 
}
on 1:TEXT:*:?:{
  if ($nick == $me) { halt }
  if ($nick !== $me) && (%avvisamsgqueryaway) { .notice $nick Mi spiace sono Away perchè ( %awaymotivo ) Page ( $+ %awaypage $+ ) Il tuo messaggio è stato loggato %pic }
  if ($dialog(away) != $null) { /did -a away 5 [[ $+ $time(HH:nn) $+ ]] < $nick > $1-  $crlf }  
  if ($dialog(away) == $null) { /diaway | /did -a away 5 [[ $+ $time(HH:nn) $+ ]] < $nick > $1- $+ $crlf }
  halt
}
on 1:ACTION:*:?:{
  if ($nick == $me) { halt } 
  if ($nick !== $me) && (%avvisamsgqueryaway) { .notice $nick Mi spiace sono Away perchè ( %awaymotivo ) Page ( $+ %awaypage $+ ) Il tuo messaggio è stato loggato %pic }
  if ($dialog(away) != $null) { /did -a away 5 [[ $+ $time(HH:nn) $+ ]] * $nick  $1-  $+ $crlf }  
  if ($dialog(away) == $null) { /diaway | /did -a away 5 [[ $+ $time(HH:nn) $+ ]] * $nick  $1- $+ $crlf }
}
on 1:NOTICE:*:?:{
  if ($nick == $me) { halt }
  if ($nick !== $me) && (%avvisamsgqueryaway) { .notice $nick Mi spiace sono Away perchè ( %awaymotivo ) Page ( $+ %awaypage $+ ) Il tuo messaggio è stato loggato %pic }
  if ($dialog(away) != $null) { /did -a away 5 [[ $+ $time(HH:nn) $+ ]] [Notice] $nick  $1-  $+ $crlf }  
  if ($dialog(away) == $null) { /diaway | /did -a away 5 [[ $+ $time(HH:nn) $+ ]]  [Notice] $nick  $1- $+ $crlf }
}
#awaya end

alias ripetiaway {
  if (%ripetiaway) { 
    %ripetiawaySECONDI = $calc(%ripetiawayMIN * 60)
  .timeraway 0 %ripetiawaySECONDI ame sono away perchè ( %awaymotivo  ) Page ( $+ %awaypage $+ ) %pic  }
  else { halt }
}

#awayidle off
on *:INPUT:*: { 
  if (%autoaway) {
    %autoawaySECONDI = $calc(%autoawayMIN * 60) 
    .timeridle off 
  .timeridle 1 %autoawaySECONDI awayidle }
}
#awayidle end

alias awayidle {
  if (%avvisaautoaway) { dialog -m autoaway autoaway | .timerautoaway 1 10 dopoavvisaautoaway }
  else { set %awaystatus on |  VAIAUTOAWAY | diaway }
}
alias dopoavvisaautoaway { 
  if ($dialog(autoaway) != $null) { dialog -x autoaway autoaway }
  set %awaystatus on |  set %nicknormale $me | nick %nickaway  | VAIAUTOAWAY | diaway | did -b away 3 | did -e away 21 
}

ctcp 1:PAGE:{
  if (%awaypage == on) { echo $colour(info) -a %prefisso Ctcp Page: Sei ricercato urgentemente da $nick | .notice $nick Ho ricevuto la tua richiesta. Se sono nei pressi dello computer risponderò. %script | splay pager.wav }
}

;=======================DIALOG DI CONFERMA AUTOAWAY ======================================

dialog autoaway {
  title "Ms3.1"
  size -1 -1 220 80
  button "hide", 1, 1 1 1 1
  box "", 2, 5 0 210 75
  text "Lo script ti setterà Away per inattività tra 10 secondi. Annullare l'operazione?", 3, 10 10 200 35
  button "Sì", 4, 40 45 60 21
  button "No", 5, 120 45 60 21,ok
}
on *:dialog:autoaway:init:0:{ mdxbegin | mdx SetFont 3,4,5 12 400 Tahoma | mdx SetBorderStyle 4,5 staticedge }
on *:dialog:autoaway:sclick:*:{
  if ($did == 4) { .timerautoaway off | dialog -x autoaway autoaway }
}
;==================== ALIAS AWAY PER LA DINAMICITA' ==========================================

alias guidainaway { 
  unset %guidaaway | var %guidainawayX 450 | :diminuisci 
  if (%guidainawayX > 300) { dialog -s away -1 -1 %guidainawayX 275 | dec %guidainawayX | goto diminuisci
  }
  else { halt }
}

alias guidaoutaway { 
  set %guidaaway on | var %guidaoutawayX 300 | :incrementa 
  if (%guidaoutawayX < 450) { dialog -s away -1 -1 %guidaoutawayX 275 | inc %guidaoutawayX | goto incrementa
  }
  else { halt }
}
</AWAY>
alias mp3sys { if (!$dialog(mp3))  dialog -mod mp3 mp3 }
dialog mp3 {
  Title "Mp3 playlist - Ms3.1"
  size -1 -1 298 210
  box "Mp3", 2, 5 1 288 129
  list 3, 8 14 280 110, size
  box "", 4, 190 128 103 33,tab 500
  button "Add (+)",5, 194 139 46 19, tab 500
  button "Rem (-)", 6, 242 139 46 19,tab 500
  box "", 8, 5 128 183 33,500, tab 500
  button "9", 7, 10 139 33 19, tab 500
  button "4", 9, 45 139 33 19,tab 500
  button ";", 10, 80 139 33 19,tab 500
  button "<", 11, 115 139 33 19,tab 500
  button ":", 15, 150 139 33 19, tab 500
  icon 12, 8 161 30 31, images\icone\mp3.ico
  button "&Chiudi", 1, 148 168 70 19,ok
  button "&Guida >>",13, 223 168 70 19
  list 14, 303 5 140 165,size
  button "&Echo", 27, 73 168 70 19
  menu &File,16
  item "Nuova Playlist", 29,16
  item break, 30, 16
  item "Carica Lista",24,16
  item break, 26,16 
  item "Salva lista", 28,16
  item "Salva lista con nome",23,16
  item break,  25,16
  item &Chiudi, 17,16
  menu "Volume",40
  item "Basso",41,40
  item "Medio",42,40
  item "Alto",43,40
  menu "Opzioni", 18
  item "Suona successivi",22,18
  item "Ciclo", 19,18
  item "Shuffle", 21, 18
  text "www.mIRCscript.it", 44, 330 173 100 19
}
on *:dialog:mp3:*:*:{
  if ($devent == init) {
    dialog -s $dname -1 -1 298 210
    mdxbegin
    mdx SetFont 2,4,12 12 700 Tahoma
    mdx SetFont 1,3,5,6,9,13,14,27,44 12 400 Tahoma
    mdx SetFont  7,9,10,11,15 +a 22 400 webdings
    mdx SetBorderStyle 1,5,6,7,9,10,11,13,15,27 staticedge
    mdx SetControlMDX 14 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i mp3 14 1 headerdims 120:1 | did -i mp3 14 1 headertext + 0 Guida all'uso:
    mdx SetControlMDX 3 Listview report rowselect icon grid showsel single labeltip headerdrag  > sistema\dlls\views.mdx
    did -i mp3 3 1 headerdims 190:1 70:2 | did -i mp3 3 1 headertext + 0 Titolo: $+ $chr(9) $+ 0 Durata:
    var %rigo = 1 | while $lines(dati\guide\mp3.txt) >= %rigo { did -az mp3 14 $read -l $+ %rigo dati\guide\mp3.txt | inc %rigo } 
    caricamp3
    unset %guidamp3
    if (%ripetimp3) { did -c mp3 19,18 }
    if (%succmp3) { did -c mp3 22,18 }
    if (%shuffle) { did -c mp3 21,18 | did -b mp3 19,22,18 }
    if (%playlistfile != sistema\mp3.txt) && if (%playlistfile != $null) { did -ra mp3 2 Mp3 List: $nopath(%playlistfile) | cancella_scrivi_mp3 }
    if ($vol(song) <= 25000) { did -c mp3 41 } | if ($vol(song) > 25000) && ($vol(song) <= 50000) { did -c mp3 42 } | if ($vol(song) > 50000) { did -c mp3 43 }
  }
  if ($devent == sclick) {
    if ($did == 3) { set %mp3sel $did(mp3,3).sel | set %mp3num $did(mp3,3).sel }
    if ($did == 5) { set %addmp3 $$dir="Seleziona un mp3 da aggiungere:" [ $mircdir $+ *.mp3 ] | if (%addmp3 != $null) { write sistema\mp3.txt %addmp3 | did -i mp3 3 1 seticon list 0,images/icone/mp3file.ico | did -a mp3 3 +b 1 $remove($nopath(%addmp3),.mp3) $+ $chr(9) $+ $duration($calc($mp3(%addmp3).length / 1003))  } }
    ;$sfile(c:\, Seleziona un mp3 da aggiungere alla lista) | if (%addmp3 != $null) { write sistema\mp3.txt %addmp3 | did -i mp3 3 1 seticon list 0,images/icone/mp3file.ico | did -a mp3 3 +b 1 $remove($nopath(%addmp3),.mp3) $+ $chr(9) $+ $duration($calc($mp3(%addmp3).length / 1003))  } }
    if ($did == 6) { if ($did(mp3,3).sel != $null) { write -dl $+ $calc($did(mp3,3).sel - 1) sistema\mp3.txt | did -d mp3 3 $calc($did(mp3,3).sel) } }
    if ($did == 7) { dec %mp3num | if ($read(sistema\mp3.txt,$calc(%mp3num -1)) != $null)  { splay -p $read(sistema\mp3.txt,$calc(%mp3num - 1)) | avvisamp3 } | else { inc %mp3num } }
    if ($did == 9) { 
      if ($did(mp3,3).sel != $null) { set %mp3num $did(mp3,3).sel | splay -p $read($mircdirsistema\mp3.txt,$calc(%mp3num - 1)) | avvisamp3 } 
      if (%shuffle) { splay -p $read($mircdirsistema\mp3.txt,$rand(1,$lines($mircdirsistema\mp3.txt))) | avvisamp3 }
    }
    if ($did == 10) { if (%pausa) { .splay resume | unset %pausa } | else { .splay pause | set %pausa on } }
    if ($did == 11) { splay stop }
    if ($did == 13) { if (%guidamp3) { did -ra mp3 13 Guida >> | guidainmp3 } | else { did -ra mp3 13 Guida << | guidaoutmp3 } }
    if ($did == 15) { inc %mp3num | if ($read(sistema\mp3.txt,$calc(%mp3num - 1)) != $null) { splay -p $read(sistema\mp3.txt,$calc(%mp3num - 1)) | avvisamp3 | else { dec %mp3num } } }
    if ($did == 27) { dialog -mo echomp3 echomp3 }
  }
  if ($devent == dclick) {
    if ($did == 3) { 
    set %mp3num $did(mp3,3).sel | splay -p $read($mircdirsistema\mp3.txt,$calc(%mp3num - 1)) | avvisamp3 }
  }
  if ($devent == menu) {
    if ($did == 17) { dialog -x mp3 mp3 }
    if ($did == 19) { if (%ripetimp3) { unset %ripetimp3 | did -u mp3 19 } | else { set %ripetimp3 on | did -c mp3 19 } }
    if ($did == 21) { if (%shuffle) { unset %shuffle | did -u mp3 21 | did -e mp3 19,22 } | else { set %shuffle on | did -c mp3 21 | did -b mp3 19,22 } }
    if ($did == 22) { if (%succmp3) { unset %succmp3 | did -u mp3 22  } | else { set %succmp3 on | did -c mp3 22 } }
    if ($did == 23) { dialog -mo savelist savelist }
    if ($did == 24) { set %playlistold %playlistfile | set %playlistfile $$dir="Seleziona un file lista:" [ $mircdirdati/mp3list/ $+ *.txt ] | if (%playlistfile == $null) { set %playlistfile %playlistold } | else { did -r mp3 3 | caricamp3 | did -ra mp3 2 Playlist: $nopath(%playlistfile) | write -c sistema\mp3.txt | var %i = 1 | while $lines(%playlistfile) >= %i { write sistema/mp3.txt $read(%playlistfile,%i) | inc %i } } }
    if ($did == 28) { if (%playlistfile != sistema\mp3.txt) { write -c %playlistfile | var %i = 1 | while $lines(sistema\mp3.txt) >= %i { write %playlistfile  $read(sistema\mp3.txt,%i) | inc %i } } }
    if ($did == 29) { write -c sistema\mp3.txt | unset %playlistfile | caricamp3 | did -ra mp3 2 Nuova Playlist | did -r mp3 3 }
    if ($did == 31) { dialog -mo setdir setdir }
    if ($did == 41) { vol -p 25000 | did -c mp3 41 | did -u mp3 42,43 }
    if ($did == 42) { vol -p 50000 | did -c mp3 42 | did -u mp3 41,43 } 
    if ($did == 43) { vol -p 65535 | did -c mp3 43 | did -u mp3 41,42 }
  }
}
alias cancella_scrivi_mp3 {
  write -c sistema\mp3.txt
  var %i = 1 | while $lines(%playlistfile) >= %i { write sistema\mp3.txt $read(%playlistfile,%i) | inc %i } 
}
dialog savelist {
  title "Salva con nome Mp3 Playlist"
  size -1 -1 230 100
  box "", 2, 5 1 220 95
  text "Inserisci il nome (con estensione .txt) da dare a questa playlist:", 3, 10 10 218 25
  edit "", 4, 55 45 120 19
  button "&Salva", 5, 120 70 70 19
  button "&Annulla",1, 40 70 70 19,ok
}
on *:dialog:savelist:*:*:{
  if ($devent == init) {
    mdxbegin
    mdx SetFont 1,3,4,5 12 400 Tahoma
    mdx SetBorderStyle 1,5 staticedge
  }
  if ($devent == sclick) {
    if ($did == 5) { var %i = 1 | while $lines(sistema\mp3.txt) >= %i { write dati\mp3list\ $+ $did(savelist,4).text $read(sistema\mp3.txt,%i) | inc %i } | dialog -x savelist savelist }
  }
}
on 1:mp3end: {
  if (%shuffle == $null) {
    if (%succmp3) { inc %mp3num | if ($read(sistema/mp3.txt,$calc(%mp3num -1)) != $null) { splay -p $read(sistema/mp3.txt,$calc(%mp3num - 1)) | avvisamp3 } | else { if (%ripetimp3) { set %mp3num 2 | splay -p $read(sistema/mp3.txt,$calc(%mp3num - 1)) | avvisamp3 } } }
  }
  else { set %mp3num $rand(1,$lines(sistema\mp3.txt)) |  splay -p $read(sistema\mp3.txt,%mp3num) | avvisamp3 }
}
alias caricamp3 {
  if (%playlistfile == $null) { set %playlistfile sistema\mp3.txt  }  
  else var %i = 1 | while $lines(%playlistfile) >= %i { did -i mp3 3 1 seticon list 0,images/icone/mp3file.ico | did -a mp3 3 +b 1 $remove($nopath($read(%playlistfile,%i)),.mp3) $+ $chr(9) $+ $duration($calc($mp3($read(%playlistfile,%i)).length / 1003)) | inc %i } 
} 
alias avvisamp3 {
  if (%echomp3 == Disattivo) || (------ isin %echomp3) { halt }
  if (%echomp3 == Tutti i canali) { ame $replace(%msgechomp3,&mp3,( $nopath($inmp3.fname) )) %pic }
  if (%echomp3 == finestra attiva) { me $replace(%msgechomp3,&mp3,( $nopath($inmp3.fname) )) %pic  }
}
dialog echomp3 {
  title "Settaggio Echo"
  size -1 -1 320 107
  box "", 2, 5 1 310 102
  text "Scrivi l'Echo o selezionalo tra i disponibili con un doppio click:", 3, 10 10 290 21
  combo 4, 10 30 83 50,drop,size
  edit "", 5, 100 30 210 21,autohs
  list 6, 8 55 240 43,size,vsbar
  button "Add", 7, 249 56 30 18
  button "Rem", 8, 281 56 30 18
  button "Chiudi", 9, 249 76 62 18,ok
}
on *:dialog:echomp3:*:*:{
  if ($devent == init) {
    mdxbegin
    mdx SetFont 3,4,5,6,7,8,9 12 400 Tahoma
    mdx SetBorderStyle 7,8,9 staticedge
    var %rigo = 1 | while $lines(dati\echomp3.txt) >= %rigo { did -az echomp3 6 $read -l $+ %rigo dati\echomp3.txt | inc %rigo } 
    if (%echomp3 == Disattivo) || (%echomp3 == $null) || (---- isin %echomp3) { did -a echomp3 4 Disattivo | did -a echomp3 4 ------------ |  did -a echomp3 4 tutti i canali | did -a echomp3 4  finestra attiva  | did -c echomp3 4 1 | did -b echomp3 5,6,7,8 }
    if (%echomp3 == tutti i canali) { did -a echomp3 4 tutti i canali | did -a echomp3 4  finestra attiva | did -a echomp3 4 ------------ | did -a echomp3 4 Disattivo | did -c echomp3 4 1 | did -e echomp3 5,6,7,8 }
    if (%echomp3 == finestra attiva) { did -a echomp3 4 finestra attiva | did -a echomp3 4 tutti i canali | did -a echomp3 4 ------------ | did -a echomp3 4 Disattivo | did -c echomp3 4 1 | did -e echomp3 5,6,7,8 }
    did -ra echomp3 5 %msgechomp3
    did -b echomp3 7,8
  }
  if ($devent == sclick) {
    if ($did == 4) { set %echomp3 $did(echomp3,4).text | if (%echomp3 == Disattivo) { did -b echomp3 5,6,7,8  } | if (%echomp3 == ------------) { did -b echomp3 5,6,7,8  }  | if (%echomp3 == tutti i canali) { did -e echomp3 5,6,7,8 } | if (%echomp3 == finestra attiva) { did -e echomp3 5,6,7,8  } }
    if ($did == 6) { did -e echomp3 8 | did -b echomp3 7 }
    if ($did == 8) { if ($did(echomp3,6).sel != $null) { write -dl $+ $did(echomp3,6).sel dati\echomp3.txt } | aggiornaecho }
    if ($did == 7) { write dati\echomp3.txt %msgechomp3 | aggiornaecho }
  }
  if ($devent == dclick) {
    if ($did == 6) { set %msgechomp3 $did(echomp3,6).seltext | did -ra echomp3 5 %msgechomp3 }
  }
  if ($devent == edit) {
    if ($did == 5) { set %msgechomp3 $did(echomp3,5).text |  did -e echomp3 7 }
  }
}
alias aggiornaecho { did -r echomp3 6 | var %rigo = 1 | while $lines(dati\echomp3.txt) >= %rigo { did -az echomp3 6 $read -l $+ %rigo dati\echomp3.txt | inc %rigo } } 

alias guidainmp3 { 
  unset %guidamp3 | var %guidainmp3X 448 | :diminuisci 
  if (%guidainmp3X > 298) { dialog -s mp3 -1 -1 %guidainmp3X 210 | dec %guidainmp3X | goto diminuisci
  }
  else { halt }
}

alias guidaoutmp3 { 
  set %guidamp3 on | var %guidaoutmp3X 298 | :incrementa 
  if (%guidaoutmp3X < 448) { dialog -s mp3 -1 -1 %guidaoutmp3X 210 | inc %guidaoutmp3X | goto incrementa
  }
  else { halt }
}
<COM>
alias opman { if ($dialog(opman) == $null) { dialog -m opman opman |  fillchanop } }
dialog opman { 
  size -1 -1 340 202
  title "Channel Operator Manager - Ms3.1"
  button "Chiudi", 1, 210 175 60 21,ok
  box "Canale", 18, 5 10 150 45
  combo 2, 10 25 140 70, drop, size
  box "Nickname", 19, 185 10 150 45
  combo 3, 190 25 140 70, drop, size
  button "Oppa" 4, 10 110 60 21
  button "Voice", 6, 10 135 60 21
  button "kick" 8, 75 110 60 21
  button "Ban", 9, 140 110 60 21
  button "Ban/kick", 10, 205 110 60 21
  button "mIRC channel central", 11, 75 135 190 21
  button "Dns", 5, 270 110 60 21
  button "Info", 7, 270 135 60 21
  button "Guida >>", 12, 275 175 60 21
  list 13, 345 20 140 160,size
  box "Comandi Operatore", 14,5 90 330 75
  text "Assistente:", 15, 10 67 60 21 
  edit "", 16, 65 60 270 20,read
  check "Mostra quando vieni oppato", 17, 60 175 145 21
  icon 20, 10 168 35 35, images/icone/channelopman.ico
  text "www.mIRCscript.it", 21, 370 185 90 21
}

on *:dialog:opman:*:*:{
  if ($devent == sclick) {
    if ($did == 1) { unset %chansel %nicksel }
    if ($did == 2) { set %chansel $did(opman,2).text | did -ra opman 16 Ora selezionare un nick nel box di destra | fillnickchan | did -ra opman 11 mIRC channel central %chansel } 
    if ($did == 3) { set %nicksel $did(opman,3).text 
      if (%nicksel isop %chansel) { did -ra opman 16 L'utente è operatore nel canale %chansel | did -ra opman 4 Deoppa }
      if (%nicksel isvo %chansel) { did -ra opman 16 L'utente è voice nel canale %chansel | did -ra opman 6 Devoice | did -ra opman 4 Oppa }
      if (%nicksel !isop %chansel) && (%nicksel !isvo %chansel) { did -ra opman 16 L'utente è un utente semplice nel canale %chansel | did -ra opman 4 Oppa | did -ra opman 6 Voice }
    }
    if ($did == 4) { if (%nicksel isop %chansel) && (%nicksel isin %chansel) { mode %chansel -o %nicksel | did -ra opman 4 Oppa | did -ra opman 16 %nicksel è stato deoppato nel canale %chansel  } | else if (%nicksel ison %chansel) { mode %chansel +o %nicksel | did -ra opman 4 Deoppa | did -ra opman 16 %nicksel è stato oppato nel canale %chansel } }
    if ($did == 5)  { dns %nicksel | set %dnsopman on } 
    if ($did == 6) { if (%nicksel isvo %chansel) { mode %chansel -v %nicksel | did -ra opman 6 Voice | did -ra opman 16 %nicksel è stato devocalizzato nel canale %chansel } | else if (%nicksel ison %chansel) { mode %chansel +v %nicksel | did -ra opman 6 Devoice | did -ra opman 16 %nicksel è stato vocalizzato nel canale %chansel } }
    if ($did == 7) { if (%nicksel) { uwho %nicksel | did -ra opman 16 Info di %nicksel in corso... attendere prego. } | else { dir -ra opman 16 Selezionare un nickname } }
    if ($did == 8) { if (%nicksel != $null) && (%nicksel ison %chansel) { kick %chansel %nicksel C.O.M. kick  %script | did -ra opman 16 L'utente %nicksel è stato kickato da %chansel } }
    if ($did == 9) { if (%nicksel != $null) && (%nicksel ison %chansel) { ban %chansel %nicksel 2 | did -ra opman 16 L'utente %nicksel è stato bannato da %chansel } }
    if ($did == 10) { if (%nicksel != $null) && (%nicksel ison %chansel) { ban %chansel %nicksel 2 | .timer 1 3 kick %chansel %nicksel C.O.M. Ban/Kick %script } }
    if ($did == 11) { if (%chansel != $null) { channel %chansel } }
    if ($did == 12) { if (%guidaCOM) { did -ra opman 12 Guida >> | guidainCOM } | else { did -ra opman 12 Guida << | guidaoutCOM } }
    if ($did == 17) { if ($did(opman,17).state == 1) { set %opman on } | else { unset %opman } }
  }
  if ($devent == init) {
    mdxbegin
    mdx SetFont 1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,21 12 400 Tahoma
    mdx SetFont 14,18,19 12 700 Tahoma
    mdx SetBorderStyle 1,4,5,6,7,8,9,10,11,12 staticedge
    mdx SetBorderStyle 14 clientedge
    mdx SetControlMDX 13 ListView report rowselect showsel single labeltip headerdrag > sistema\dlls\ $+ views.mdx
    did -i opman 13 1 headerdims 120:1 | did -i opman 13 1 headertext + 0 Guida all'uso:
    var %rigo = 1 | while $lines(dati\guide\com.txt) >= %rigo { did -az opman 13 $read -l $+ %rigo dati\guide\com.txt | inc %rigo } 
    unset %guidaCOM
    if (%opman) { did -c opman 17 }
    if (%chansel) || (%nicksel) {  unset %chansel %nicksel }
    if (%chansel == $null) && (%nicksel == $null) { did -ra opman 16 Seleziona un canale in cui sei op, quindi un utente. }
    did -t opman 1
  }
}
alias fillnickchan {
  did -r opman 3 | var %nicktotali $nick(%chansel,0), %nick1x1 1
  :loop
  if (%nick1x1 > %nicktotali) { goto end }
  did -a opman 3 $nick(%chansel,%nick1x1) | inc %nick1x1
  goto loop
  :end
}
alias fillchanop {
  var %opchan $chan(0), %chandaux 1
  :loop
  if (%chandaux > %opchan) { goto end }
  if ($me isop $chan(%chandaux)) { did -a opman 2 $chan(%chandaux) }
  inc %chandaux
  goto loop
  :end
}

on 1:OP:#:{ 
  if ($opnick == $me) && (%msgonop) { msg #  $replace(%msgonoptext,&nick,$nick,&chan,$chan) %pic }
  if ($opnick == $me) {
    if (%opman) { opman }
    if ($chan != $active) { echo $colour(info) -a %prefisso [Info Script] Sei stato oppato su # da $nick  }
  }
}
on 1:VOICE:#:{ 
  if ($vnick == $me) && (%msgonvoice) { msg #  $replace(%msgonvoicetext,&nick,$nick,&chan,$chan)  %pic }
}
on 1:DEOP:#:{ 
  if ($opnick == $me) && (%msgondeop) { msg # $replace(%msgondeoptext,&nick,$nick,&chan,$chan)  %pic }
  if ($opnick == $me) && ($chan != $active) {
  echo $colour(info) -a %prefisso [Info Script] Sei stato deoppato su # da $nick  }
}
on 1:DEVOICE:#:{ 
  if ($vnick == $me) && (%msgondevoice) { msg # $replace(%msgondevoicetext,&nick,$nick,&chan,$chan)  %pic }
}
;=========== ALIAS PER LA DINAMICITA' =======================
alias guidainCOM { 
  unset %guidaCOM | var %guidainCOMX 490 | :diminuisci 
  if (%guidainCOMX > 340) { dialog -s opman -1 -1 %guidainCOMX 202 | dec %guidainCOMX | goto diminuisci } |  else { halt }
}
alias guidaoutCOM { 
  set %guidaCOM on | var %guidaoutCOMX 340 | :incrementa 
  if (%guidaoutCOMX < 490) { dialog -s opman -1 -1 %guidaoutCOMX 202 | inc %guidaoutCOMX | goto incrementa } | else { halt }
}
</COM>
