menu menubar {
  -
  Arcan]G[elo tools
  .» Word Processor:/word
}
on *:load: {
  set %w.c N/A
  set %w.df mm/dd/yyyy
  set %w.e Homer@scriptingworld.org
  set %w.n Homer
  set %w.tdf h:nn:ss TT mm/dd/yyyy
  set %w.tf h:nn:ss TT
  set %w.w http://www.scriptingworld.org
  set %w.ls *.wpf
}
dialog word {
  title "Word Processor v0.2.1 (Untitled)"
  size -1 -1 380 270
  option dbu
  menu "&File",1
  item "&Nuovo",2
  item "&Apri",3
  item break, 39
  item "&Salva",4
  item "Salva &Come...",5
  item break,6
  item "&Stampa",37
  item break, 38
  item "&Esci",7, ok
  menu "&Modifica",8
  item "&Copia     Ctrl+V",9
  item "&Incolla    Ctrl+P",10
  menu "&Inserisci",11
  item "&Ora",12
  item "&Data",13
  item "Ora&/Data",14
  item break,15
  item "&Nome",16
  item "&Email",17
  item "&Compagnia",18
  item "&Sito Web",19
  item break,20
  item "mIRC &Version",21
  item "mIRC &Bits",22
  item "&Server",23
  item "&Porta",24
  item "N&ick",25
  item "Indirizzo IP",26
  item "Lista Notifica",27
  item break,28
  item "Edita inserisci...",29
  edit "",30, 0 10 380 251, multi return hsbar vsbar
  button "posizione",31, 0 0 0 0
  menu "Help",32
  item "About",33
  check "",34, 0 1 6 6
  text "Formattazzione",340, 8 1 37 6
  combo 35, 52 0 45 50, drop, disable
  combo 36, 103 0 25 50, drop, disable
  button "Annulla",50, 0 0 0 0, cancel
}

on *:dialog:word:init:*: {
  if (%unome == 1) {
    dll dlls\mdx\mdx.dll MarkDialog $dname
    dll dlls\mdx\mdx.dll SetMircVersion $version
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor 34,340,35,36 background $dname bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 340 textbg $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 34,35,36 textbg $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 34,340,35,36 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 31,50 background $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetDialog $dname style border title sysmenu
    dll dlls\mdx\mdx.dll SetControlMDX $dname 31 Positioner size minbox > dialog.mdx
    dll dlls\mdx\mdx.dll SetFont $dname 30 + 9 400 Fixedsys
  }
  if (%unome == 2) {
    dll dlls\mdx\mdx.dll MarkDialog $dname
    dll dlls\mdx\mdx.dll SetMircVersion $version
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor 34,340,35,36 background $dname bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 340 textbg $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 34,35,36 textbg $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 34,340,35,36 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 31,50 background $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetDialog $dname style border title sysmenu
    dll dlls\mdx\mdx.dll SetControlMDX $dname 31 Positioner size minbox > dialog.mdx
    dll dlls\mdx\mdx.dll SetFont $dname 30 + 9 400 Fixedsys
  }
  %w.doc = Untitled
  didtok $dname 35 34 Tahoma"MS Sans Serif"Lucida Console"Fixedsys"IBMpc"Terminal"Courier New"Arial"MS Linedraw
  didtok $dname 36 32 12 16 20
  did -c $dname 35,36 1
}
on *:dialog:word:sclick:50:rmtmp
on *:dialog:word:sclick:35:sfs
on *:dialog:word:sclick:36:sfs
on *:dialog:word:sclick:34: {
  if ($frmt) { did -e $dname 35,36 | sfs }
  else { did -b $dname 35,36 | mdx SetFont $dname 30 + 9 400 Fixedsys }
}
on *:dialog:word:sclick:31: {
  tokenize 32 $did(31,1)
  if ($1-2 == sizing normal) {
    mdx MoveControl $dname 30 * * * $calc($11 - 20)
    mdx MoveControl $dname 30 * * $10 * 
  } 
}
on *:dialog:word:menu:*: {
  if ($did == 33) { dialog -md word.abt word.abt | if ( %cc181p == on ) { $tunder TDDialog $dialog(word.abt).hwnd > 10 } }
  if ($did == 2) {
    if ($did(30).edited) { 
      var %tmp = $input(Sakva come $nopath(%w.doc) $+ ?,176,Salvare?)
      if (%tmp == $yes) { w.sv }
      did -r $dname 30 | did -j $dname 30 | %w.doc = Untitled | dialog -t $dname Word Processor (Untitled)
    }
    else { did -r $dname 30 | %w.doc = Untitled | dialog -t $dname Word Processor (Untitled) }
  }
  if ($did == 3) {
    if ($did(30).edited) { 
      %tmp = $input(Salva come $nopath(%w.doc) $+ ?,176,Salvare?)
      if (%tmp == $yes) { w.sv }
      if (%tmp == $cancel) { halt }
      if (%tmp == $no) { w.o }
      did -j $dname 30
      w.o
    }
    else { w.o }
  }
  if ($did == 4) { w.sv }
  if ($did == 5) { w.sv 1 }
  if ($did == 7) {
    if ($did(30).edited) { 
      var %tmp = $input(Salva come $nopath(%w.doc) $+ ?,176,Salvare?)
      if (%tmp == $yes) { w.sv }
      if (%tmp == $cancel) { halt }
      %w.doc = Untitled
    }
    .rmdir wordtmp
  }
  if ($did == 9) { clipboard $did(30).seltext }
  if ($did == 10) {
    var %i = 0
    while %i < $cb(0) {
      inc %i
      did -a $dname 30 $cb(%i) $+ $crlf
    }
  }
  if ($did == 12) { did -a $dname 30 $time(%w.tf) }
  if ($did == 13) { did -a $dname 30 $time(%w.df) }
  if ($did == 14) { did -a $dname 30 $time(%w.tdf) }
  if ($did == 16) { did -a $dname 30 %w.n }
  if ($did == 17) { did -a $dname 30 %w.e }
  if ($did == 18) { did -a $dname 30 %w.c }
  if ($did == 19) { did -a $dname 30 %w.w }
  if ($did == 21) { did -a $dname 30 $version }
  if ($did == 22) { did -a $dname 30 $bits }
  if ($did == 23) { if ($server == $Null) { %tmp = $input(Non sei collegato a un server IRC,516,Errore) | unset %tmp | halt } | did -a $dname 30 $server }
  if ($did == 24) { if ($server == $Null) { %tmp = $input(Non sei collegato a un server IRC,516,Errore) | unset %tmp | halt } | did -a $dname 30 $port }
  if ($did == 25) { if ($me == $null) { %tmp = $input(Non hai settato il tuo nick, digita /nuovonick.,516,Errore) | unset %tmp | halt } | did -a $dname 30 $me }
  if ($did == 26) { if ($ip == $Null) { %tmp = $input(Non sei collegato a un server IRC,devi esserlo per ricavare il tuo ip,516,Errore) | unset %tmp | halt } | did -a $dname 30 $ip }
  if ($did == 27) {
    %i = 0
    while %i < $notify(0) {
      inc %i
      did -a $dname 30 $notify(%i) $+ $crlf
    }
  }
  if ($did == 29) { w.ed }
  if ($did == 37) { print }
}
dialog w.ed {
  title "Word Processor Info Editor"
  size -1 -1 157 200
  option dbu
  button "OK",1, 58.5 177 40 20, ok
  box "Time && Date",2, 5 2 147 80
  button "View Time/Date Legend",3, 42 70 70 10
  text "Enter Time Format",4, 7 10 44 6
  edit "",5, 7 19 70 10, autohs
  text "Enter Date  Format",6, 7 30 46 6
  edit "",7, 7 39 70 10, autohs
  text "Enter Time/ Date Format",8, 7 50 59 6
  edit "",9, 7 59 70 10, autohs
  edit "",10, 80 19 70 10, autohs
  edit "",11, 80 39 70 10, autohs
  edit "",12, 80 59 70 10, autohs
  text "Preview",13, 82 10 30 8
  box "Personal Info",14, 5 84 147 90
  text "Enter Name",15, 7 92 28 6
  edit "",16, 7 101 143 10, autohs
  text "Enter E-mail  Address",17, 7 112 51 6
  edit "",18, 7 121 143 10, autohs
  text "Enter Company Name",19, 7 132 52 6
  edit "",20, 7 141 143 10, autohs
  text "Enter Website Address",21, 7 152 55 6
  edit "",22, 7 161 143 10, autohs
}
on *:dialog:w.ed:sclick:1:dialog -v word word
on *:dialog:w.ed:init:*: {
  dll dlls\mdx\mdx.dll MarkDialog $dname
  dll dlls\mdx\mdx.dll SetMircVersion $version    
  if (%unome = 1) {
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,72,170)
    dll dlls/mdx/mdx.dll SetColor $dname 2,14 background $rgb(255,134,0)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,13,16,18,20,22 background $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,15,17,19,21 background bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,13,15,17,19,21 background $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,13,15,17,19,21 textbg $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,16,18,20,22 background $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,16,18,20,22 textbg $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 4,6,8,15,17,19,21 background $dname bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor 4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 1,3 background $rgb(0,72,170)
  }
  if (%unome = 2) {
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,0,95)
    dll dlls/mdx/mdx.dll SetColor $dname 2,14 background $rgb(196,196,196)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,13,16,18,20,22 background $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,15,17,19,21 background bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,13,15,17,19,21 background $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 4,6,8,13,15,17,19,21 textbg $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,16,18,20,22 background $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 5,7,9,10,11,12,16,18,20,22 textbg $dname bgcolor $rgb(0,0,0)
    dll dlls\mdx\mdx.dll SetColor 4,6,8,15,17,19,21 background $dname bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor 4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 1,3 background $rgb(0,0,95)
  }
  did -a $dname 5 %w.tf
  did -a $dname 7 %w.df
  did -a $dname 9 %w.tdf
  did -a $dname 16 %w.n
  did -a $dname 18 %w.e
  did -a $dname 20 %w.c
  did -a $dname 22 %w.w
  .timerw.pv 0 1 w.pv
}

on *:dialog:w.ed:edit:*: {
  if ($did == 5) { %w.tf = $did(5) }
  if ($did == 7) { %w.df = $did(7) }
  if ($did == 9) { %w.tdf = $did(9) }
  if ($did == 16) { %w.n = $did(16) }
  if ($did == 18) { %w.e = $did(18) }
  if ($did == 20) { %w.c = $did(20) }
  if ($did == 22) { %w.w = $did(22) }
}
on *:dialog:w.ed:sclick:3: var %tmp = $input(Time/Date Legend: $crlf $crlf H = hours (24-hr) $crlf h = hours (standard) $crlf n = minutes $crlf s = seconds $crlf TT = AM/PM $crlf T = a/p $crlf tt = am/pm $crlf t = a/p $crlf $crlf d = day (number) $crlf ddd = day (short) $crlf dddd = day (full) $crlf m = month (same format as day) $crlf y = year (same format as day),4,Time/Date Legend)

dialog word.abt {
  title "About Word Processor v0.2.1"
  size -1 -1 117 67
  option dbu
  text "Word Processor v0.2.1 Build 113", 1, 2 1 80 8
  text "By Homer", 2, 2 9 25 8
  text "Latest mIRC at release date: 5.91", 3, 2 32 79 8
  text "Release Date: December 9, 2001", 4, 2 24 80 8
  text "For scripts, addons, dlls, tutorials and more, visit:", 5, 2 48 114 8
  link "http://scriptingworld.org", 6, 25 56 65 8
  button "Button", 7, 116 -1 2 3, hide cancel
}
on *:dialog:word.abt:init:*: {
  if (%unome == 1) {
    dll dlls\mdx\mdx.dll MarkDialog $dname
    dll dlls\mdx\mdx.dll SetMircVersion $version
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 background $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 textbg $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor 1,2,3,4,5,6 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 7 background $rgb(0,72,170)
  }
  if (%unome == 2) {
    dll dlls\mdx\mdx.dll MarkDialog $dname
    dll dlls\mdx\mdx.dll SetMircVersion $version
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 background $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 textbg $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor 1,2,3,4,5,6 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 7 background $rgb(0,0,95)
  }
}
on *:dialog:word.abt:sclick:7:if ($dialog(word)) dialog -v word word
on *:dialog:word.abt:sclick:6:run $did($did)
dialog word.ld {
  title "Thanks!"
  size -1 -1 174 70
  option dbu
  text "Thanks for downloading Word Processor v0.2.1.", 1, 2 2 110 8
  text "To use this, just select Word Processor from the menubar, or type /word.", 2, 2 12 171 8
  text "Send Questions/comments to:", 3, 4 30 72 8
  link "Homer@scriptingworld.org", 4, 77 30 67 8
  text "Visit my website at:", 5, 4 40 45 8
  link "http://scriptingworld.org", 6, 77 40 65 8
  button "&Close", 7, 2 56 65 12, ok
  button "&Run Word Processor", 8, 107 56 65 12
}
on *:dialog:word.ld:init:*: {
  dll dlls\mdx\mdx.dll MarkDialog $dname
  dll dlls\mdx\mdx.dll SetMircVersion $version
  if (%unome == 1) {
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 background $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 textbg $rgb(0,72,170)
    dll dlls\mdx\mdx.dll SetColor 1,2,3,4,5,6 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 7,8 background $rgb(0,72,170)
  }
  if (%unome == 2) {
    dll dlls\mdx\mdx.dll SetDialog $dname bgcolor $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 background $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor $dname 1,2,3,4,5,6 textbg $rgb(0,0,95)
    dll dlls\mdx\mdx.dll SetColor 1,2,3,4,5,6 text $rgb(255,255,255)
    dll dlls\mdx\mdx.dll SetColor $dname 7,8 background $rgb(0,0,95)
  }
}
on *:dialog:word.ld:sclick:8:word | dialog -x word.ld
on *:dialog:word.ld:sclick:4:run mailto: $+ $did(4)
on *:dialog:word.ld:sclick:6:run $did(4)
alias word dialog -md word word |  if ( %cc181p == on ) { $tunder TDDialog $dialog(word).hwnd > 2 }
alias -l w.ed dialog -m w.ed w.ed | if ( %cc181p == on ) { $tunder TDDialog $dialog(w.ed).hwnd > 10 }
alias -l w.pv {
  if ($dialog(w.ed)) {
    did -o w.ed 10 1 $time(%w.tf)
    did -o w.ed 11 1 $time(%w.df)
    did -o w.ed 12 1 $time(%w.tdf)
  }
}

alias -l w.o {
  var %tmp = " $+ $sfile(C:\*.wpf,Open,Open) $+ "
  if (%tmp == $Null) { halt }
  if ($gettok(%tmp,-1,46) == wpf") {
    loadbuf $calc($lines(%tmp) - 1) -ro word 30 %tmp
    mdx SetFont word 30 + $gettok($read(%tmp,1),2,19) 400 $gettok($read(%tmp,1),1,19)
    mdx SetFont word 30 + $gettok($read(%tmp,1),2,19) 400 $gettok($read(%tmp,1),1,19)
    did -c word 34 | did -e word 35,36
    did -c word 36 $didwm(word,36,$gettok($read(%tmp,1),2,19))
    did -c word 35 $didwm(word,35,$gettok($read(%tmp,1),1,19))
  }
  else { loadbuf $lines(%tmp) -ro word 30 %tmp }
  dialog -t word Word Processor ( $+ $nopath(%tmp) $+ )
  %w.doc = %tmp
  did -j word 30
}
alias -l w.sv {
  if ($1 != $Null) || (%w.doc == Untitled) {
    :start
    var %tmp = $sfile(C:\ $+ $iif($frmt,*.wpf,*.txt),Save As,Save)
    if ($isfile(%tmp)) {
      %tmp1 = $input(Replace existing file ( $+ $nopath(%tmp) $+ )?,296,Replace File?)
      if (%tmp1 != $yes) {
        goto start
      }
    }
    %w.doc = %tmp
  }
  if ($frmt) { write -c %w.doc $did(35,$did(35).sel) $+  $+ $did(36,$did(36).sel) $+ $crlf }
  savebuf $iif($frmt,-oa,-o) $did(word,30).lines word 30 %w.doc
  dialog -t word Word Processor ( $+ $nopath(%w.doc) $+ )
  did -j word 30
}
alias -l sfs {
  if ($did(36,$did(36).sel) == 12) { sfs2 | sfs2 }
  if ($did(36,$did(36).sel) == 16) { sfs2 }
  if ($did(36,$did(36).sel) == 20) { sfs2 | sfs2 }
}
alias -l sfs2 mdx SetFont word 30 + $did(36,$did(36).sel) 400 $did(35,$did(35).sel)
alias -l size {
  if ($$1 == 20) { return 3 }
  if ($$1 == 16) { return 2 }
  if ($$1 == 12) { return 1 }
}
alias -l frmt if ($did(word,34).state == 1) { return $true }
alias -l print {
  mkdir $mircdirwordtmp
  var %tmp.doc = " $+ $mircdirwordtmp\ $+ $remove($nopath(%w.doc),") $+ -temp- $+ $rand(1,1000) $+ .html $+ "
  if ($frmt) { var %tmp.fnt <font face= $+ $did(35,$did(35).sel) size= $+ $size($did(36,$did(36).sel)) $+ > | write %tmp.doc %tmp.fnt }
  var %i = 0
  while %i < $did(word,30).lines {
    inc %i
    write %tmp.doc $did(word,30,%i) $+ <br>
  }
  window -pnh @print
  var %tmp.. = $dll($scriptdirnHTMLn.dll,attach,$window(@print).hwnd)
  var %tmp.. = $dll($scriptdirnHTMLn.dll,navigate,$remove(%tmp.doc,"))
  .timer -m 1 500 print2
}
alias -l print2 {
  var %tmp.. = $dll($scriptdirnHTMLn.dll,print,$window(@print).hwnd)
  window -c @print
}
alias -l rmtmp {
  :start
  var %i = 0
  while %i < $findfile($mircdirwordtmp,*.html,0) {
    inc %i
    .remove $findfile($mircdirwordtmp,*.html,%i)
  }
  if ($findfile($mircdirwordtmp,*.html,0) > 0) { goto start }
  .rmdir $mircdirwordtmp
}