dialog notepad {
title "Notepad Editor"
size -1 -1 181 197
option dbu
edit "", 1, 0 10 181 189, multi return autohs autovs hsbar vsbar
edit "", 4, 80 0 56 10
text "Filename:", 5, 55 1 24 8
menu "File", 8
item "Open", 14, 8
item "Close", 13, 8
item "Save", 15, 8
item "Save As", 16, 8
menu "Edit", 9
item "Replace", 10, 9
item "Copy (Ctrl + C)", 11, 9
item "Paste (Ctrl + V)", 12, 9
menu "Help", 6
item "About", 7, 6
}
alias note { dialog -m notepad notepad }
alias xrep { return $read(temp.txt,w,$+(*,$did(replace,1).text,*),$1) }
on *:DIALOG:notepad:init:0:{
did -a $dname 1 Click Open File to open any readable text format such has txt wpd etc..
}
on *:dialog:notepad:menu:10:{
dialog -m replace replace
var %num = 1
while (%num <= $did($dname,1).lines) {
write temp.txt $did($dname,1,%num).text $crlf
inc %num
}
}
on *:DIALOG:notepad:menu:11:{
echo -a Copying all information in Notepad Editor
.clipboard
var %num = 1
while (%num <= $did($dname,1).lines) {
clipboard -na $did($dname,1,%num)
inc %num
}
}
on *:dialog:notepad:menu:12:{
var %num = 1
while (%num <= $cb(0)) {
did -a $dname 1 $cb(%num) $crlf
inc %num
}
}
on *:dialog:notepad:menu:13:{
dialog -x notepad
}
on *:dialog:notepad:menu:14:{
did -r $dname 1
var %nsel = $sfile(C:\) , %num = 1
did -ra $dname 4 $nopath(%nsel)
while (%num <= $lines(%nsel)) {
did -a $dname 1 $read(%nsel,%num) $crlf
inc %num
}
}
on *:dialog:notepad:menu:15:{
var %num = 1 , %ndir = $sdir(C:\)
if ($did($dname,4).edited == $true) {
var %nedit = $did($dname,4).text
if ($exists($+(%ndir,%nedit)) == $true) {
if ($?!="Do you wish to overwrite file?" == $true) {
remove $+(%ndir,%nedit)
clear -s
while (%num <= $did($dname,1).lines) {
write -a $+(%ndir,%nedit) $did($dname,1,%num) $crlf
inc %num
}
}
else { halt }
}
else {
while (%num <= $did($dname,1).lines) {
write -a $+(%ndir,%nedit) $did($dname,1,%num) $crlf
inc %num
}
}
}
}
dialog replace {
title "Replace (notepad)"
size -1 -1 155 65
option dbu
edit "", 1, 42 4 65 10
edit "", 2, 42 16 65 10
text "Find What:", 3, 6 5 27 8
text "Replace With:", 4, 6 17 35 8
box "", 5, 2 -2 110 35
box "", 6, 113 -2 40 66
box "", 7, 115 0 36 62
button "Find Next", 8, 117 5 32 12, disable flat
button "Replace", 9, 117 19 32 12, flat
button "Replace All", 10, 117 33 32 12, flat
button "Cancel", 11, 117 47 32 12, flat
box "", 12, 2 31 110 33
text "This Script is purely Beta I hold no responsibility to damaged files during replace token. This is intetionally meant to edit mIRC scripts or documents.", 13, 3 35 107 27
}
on *:dialog:replace:sclick:8:{
did -c notepad 1 $didwm(notepad,1,$+(*,$did(replace,1).text,*))
}
on *:dialog:replace:sclick:9:{
did -r notepad 1
if ($did($dname,1).edited) && ($did($dname,2).edited) {
var %rep = $xrep(1) , %num = 1
write -l $+ $readn temp.txt $replace($xrep(1),$did($dname,1),$did($dname,2).text)
while (%num <= $lines(temp.txt)) {
did -a notepad 1 $read(temp.txt,%num) $crlf
inc %num
}
dialog -x $dname
remove temp.txt
clear -s
}
else { echo -a Sorry you have NOT entered any information for me to replace }
}
on *:dialog:replace:sclick:10:{
did -r notepad 1
if ($did($dname,1).edited) && ($did($dname,2).edited) {
:START
if (!$xrep(1)) {
goto END
}
else {
var %rep = $xrep(1) , %num = 1
write -l $+ $readn temp.txt $replace($xrep(1),$did($dname,1),$did($dname,2).text)
goto START
:END
while (%num <= $lines(temp.txt)) {
did -a notepad 1 $read(temp.txt,%num) $crlf
inc %num
}
remove temp.txt
dialog -x $dname
clear -s
}
}
else { echo -a Sorry you have NOT entered any information for me to replace }
}
on *:dialog:replace:sclick:11:{
dialog -x replace
}
on *:dialog:replace:close:0:{
remove temp.txt
clear -s
}