One of my first dialogs, my first published dialog.
Usage: Right click in the status window, a channel or a PM and click on "Notepads" Which will bring up the notepad.
There's 5 different saved notepads, just click up the top to change. Note: if you change notepads and you'll be reverted back to the last save. A popup should come up reminding you (will only popup if you haven't saved since an edit) to save if you want to.
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;Conscious' Notepad Dialog;;;;
;;;;Feel free to edit or take;;;;
;;;;apart in any manner and ;;;;;
;;;;Republish in any form ;;;;;;;
;;;;Excluding Direct copying ;;;;
;;;;;;;;;Of the script.;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
dialog Npad1 {
title "Notepad"
size -1 -1 250 250
option dbu
edit "", 1, 14 34 225 194, multi return vsbar
button "Clear current without saving", 2, 20 20 106 12
button "Delete All", 3, 129 20 106 12
button "Delete Current", 4, 17 230 40 18, multi
button "Revert to last save", 5, 61 230 40 18, multi
button "Exit without saving", 6, 105 230 40 18, multi
button "Save", 7, 149 230 40 18, multi
button "Save and close", 8, 193 230 40 18, multi ok
button "Notepad 1", 9, 21 5 37 12
button "Notepad 2", 310, 65 5 37 12
button "Notepad 3", 11, 109 5 37 12
button "Notepad 4", 12, 154 5 37 12
button "Notepad 5", 13, 198 5 37 12
}
on *:dialog:Npad1:close:*: {
unset %did==1
}
on *:DIALOG:Npad1:edit:*:{
set %did==1 Yes
}
on *:dialog:Npad1:init:*: {
unset %did==1
notepadwrite
var %linesnpad1.txt 1
while (%linesnpad1.txt <= $lines(npad1.txt)) {
var %did $read(npad1.txt,%linesnpad1.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad1.txt
}
set %npadno 1
}
on *:dialog:npad1:sclick:*: {
if ($did == 2) {
did -r npad1 1
set %did==1 Yes
}
if ($did == 4) {
var %yesorno $$?!="Are you sure you want to delete the whole contents of this notepad?"
if (%yesorno == $true) { write -c npad $+ %npadno $+ .txt
did -r npad1 1
}
}
if ($did == 3) {
var %yesorno2 $$?!="Are you sure you want to delete all the contents of all 5 notepads?"
if (%yesorno2 == $true) {
write -c npad1.txt
write -c npad2.txt
write -c npad3.txt
write -c npad4.txt
write -c npad5.txt
did -r npad1 1
}
}
if ($did == 5) {
var %yesorno $$?!="Are you sure you want to revert to the last save of this notepad?"
if (%yesorno == $true) {
did -r npad1 1
var %linesnpad.txt 1
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
if ($did == 6) {
var %exit $$?!="Are you sure you want to exit without saving?"
if (%exit == $true) {
dialog -x npad1 npad1
}
}
if ($did == 7) {
unset %did==1
write -c npad $+ %npadno $+ .txt
var %did 1
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
if ($did == 8) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
dialog -x npad1 npad1
}
if ($did == 9) {
if (%npadno == 1) { dialog -m notepadfail notepadfail }
else {
var %savedpad $iif(%did==1 == yes,$$?!="Would you like to save your current notepad?",False)
unset %did==1
if (%savepad == $true) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
did -r npad1 1
var %linesnpad.txt 1
set %npadno 1
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
if ($did == 10) {
if (%npadno == 2) { dialog -m notepadfail notepadfail }
else {
var %savedpad $iif(%did==1 == yes,$$?!="Would you like to save your current notepad?",False)
unset %did==1
if (%savepad == $true) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
did -r npad1 1
set %npadno 2
var %linesnpad.txt 1
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
if ($did == 11) {
if (%npadno == 3) { dialog -m notepadfail notepadfail }
else {
var %savedpad $iif(%did==1 == yes,$$?!="Would you like to save your current notepad?",False)
unset %did==1
if (%savepad == $true) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
did -r npad1 1
var %linesnpad.txt 1
set %npadno 3
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
if ($did == 12) {
if (%npadno == 4) { dialog -m notepadfail notepadfail }
else {
var %savedpad $iif(%did==1 == yes,$$?!="Would you like to save your current notepad?",False)
unset %did==1
if (%savepad == $true) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
did -r npad1 1
var %linesnpad.txt 1
set %npadno 4
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
if ($did == 13) {
if (%npadno == 5) { dialog -m notepadfail notepadfail }
else {
var %savedpad $iif(%did==1 == yes,$$?!="Would you like to save your current notepad?",False)
unset %did==1
if (%savepad == $true) {
write -c npad $+ %npadno $+ .txt
var %did 1
write -c npad $+ %npadno $+ .txt
while (%did <= $did(1).lines) {
write npad $+ %npadno $+ .txt $did(1,%did)
inc %did
}
}
did -r npad1 1
var %linesnpad.txt 1
set %npadno 5
while (%linesnpad.txt <= $lines(npad $+ %npadno $+ .txt)) {
var %did $read(npad $+ %npadno $+ .txt, %linesnpad.txt)
did -na npad1 1 %did $+ $crlf
inc %linesnpad.txt
}
}
}
}
on *:START:{ notepadwrite }
alias -l notepadwrite {
tokenize 32 $regsubex($str(.,5),/./g,$+($chr(32),$+(npad,\n,.txt)))
scon -r $!iif(!$isfile( $* ),write $* )
}
alias notepad dialog -m npad1 npad1
dialog notepadfail {
title "Error"
size -1 -1 141 64
option dbu
text "You are already on this notepad! Click Okay to continue.", 1, 11 8 121 24
button "Okay", 2, 52 44 37 12, ok
}
menu * {
Notepads: notepad
}