(I'm not uploading a screen shot because I have my actual passwords in it ;
dialog Password {
title "Password Saver"
size -1 -1 180 150
option dbu
button "Add", 1, 60 10 20 10
button "Del", 2, 85 10 20 10, disable
button "Clear", 3, 110 10 20 10
text "Passwords", 4, 10 25 30 10
list 5, 10 35 50 100, hsbar, vsbar
text "Reasons", 6, 70 25 30 10
list 7, 70 35 100 100, hsbar, vsbar
}
dialog Add.Pass {
title "Add Password"
size -1 -1 70 30
option dbu
edit "", 1, 5 5 60 10
button "Add", 2, 15 15 20 10
button "Cancel", 3, 40 15 20 10
}
dialog Add.Reason {
title "Add Reason"
size -1 -1 120 30
option dbu
edit "", 1, 5 5 110 10
button "Add", 2, 35 15 20 10
button "Cancel", 3, 60 15 20 10
}
on *:dialog:Password:*:*:{
if ($devent == sclick) {
if ($did == 1) { dialog -m Add.Pass Add.Pass }
if ($did == 2) {
write -dl $+ $did(5).sel Pass.txt
write -dl $+ $did(7).sel Reason.txt
did -b $dname 2
did -d $dname 5 $did(5).sel
did -d $dname 7 $did(7).sel
}
if ($did == 3) {
write -c Pass.txt
write -c Reason.txt
did -r $dname 5,7
}
if ($did == 5) {
did -e $dname 2
did -c $dname 7 $did(5).sel
}
if ($did == 7) {
did -e $dname 2
did -c $dname 5 $did(7).sel
}
}
if ($devent == init) {
var %x 1
var %y 1
while ($read(Pass.txt,%x)) {
did -a $dname 5 $read(Pass.txt,%x)
inc %x
}
while ($read(Reason.txt,%y)) {
did -a $dname 7 $read(Reason.txt,%y)
inc %y
}
}
}
on *:dialog:Add.Pass:*:*:{
if ($devent == sclick) {
if ($did == 2) {
write Pass.txt $did(1)
dialog -x $dname $dname
dialog -m Add.Reason Add.Reason
}
if ($did == 3) {
dialog -x $dname $dname
}
}
}
on *:dialog:Add.Reason:*:*:{
if ($devent == sclick) {
if ($did == 2) {
write Reason.txt $did(1)
did -a Password 5 $read(Pass.txt,$lines(Pass.txt))
did -a Password 7 $did(1)
dialog -x $dname $dname
}
if ($did == 3) {
write -d $+ $lines(Pass.txt) Pass.txt
dialog -x $dname $dname
}
}
}
menu * {
-
Password Saver:passwords
}
alias passwords { dialog -m Password Password }
alias addpass {
if (!$1) { halt }
else {
if (!$2) { halt }
else {
write Pass.txt $1
write Reason.txt $2-
.timer 1 2 echo -a 14Added password 07 $1 14with reason 07 $2- $+ 14.
}
}
}
No comments:
Post a Comment