Post by zzz000abc on Nov 1, 2018 12:35:06 GMT
here is a very simple program to take notes or writing your dairy
gosub[FileCheck]
gosub[DairyCheck]
gosub[fname]
open fname$ for append as#1
while 1
k=0
print""
print"Enter List Name"
print"Or use EnterKey to Quit"
input"";t$
if t$="" then exit while
print""
call out1 t$,k
k=k+1
print "Enter The List"
Print"Or use EnterKey to make a NewList"
while 1
input"";t$
if t$="" then
print space$(20);date$();space$(1);time$()
print#1, space$(20);date$();space$(1);time$()
print#1,"---------------------------------"
exit while
end if
call out1 t$,k
wend
wend
close #1
'-----------------------------
wait
[quit]
end
'--------------------------------
wait
[FileOutPut]
sub out1 t1$,k1
if k1=1 then b$=space$(2);chr$(149)_
else b$=space$(10):a$="[":c$="]"
'print b$;t1$
print#1,b$;a$;t1$;c$
end sub
'-------------------------------
wait
'------------------------------------
[FileCheck]
'check main file exists
'check temp file exist
'if mf or tf not found creat new mf
dim info$(10,10)
mf$="dairy.sys"
tf$="dairytemp.sys"
files DefaultDir$,mf$,info$()
print info$(0,0)
mf=val(info$(0,0))
if mf>0 then
print"sys file exists"
'do noting
else
files DefaultDir$,tf$,info$()
tf=val(info$(0,0))
end if
if tf>0 then
print"system was off abruptly"
print"might be power failure"
print"please wait, updating"
end if
if mf=0 and tf=0 then
print "you may be using this first time"
print"else your System files are deleted!"
print "anyway I am working on it"
print "Ok Done"
input"press any key to continue...";a$
open mf$ for output as#1
print#1,"NewDairy MyDairy"
close #1
end if
return
wait
'-----------------------------
[DairyCheck]
new=1
old=2
ambig=3
open mf$ for input as#1
line input#1,dlist$
print dlist$
close#1
dlist$=trim$(dlist$)+chr$(32)
if dlist$<>"" then
d1$="List of Existing Dairies"
d2$="enter Existing Name or New Name"
else
d1$="no Dairies exist"
d2$="enter a name for NewDairy"
end if
print d1$
k=1
while word$(dlist$,k,chr$(32))<>""
print word$(dlist$,k,chr$(32))
k=k+1
wend
k=0
while 1
input "";d2$;" ";dname$
k=k+1
dname$=trim$(dname$)
if dname$<>"" then exit while
if k=3 then flag=ambig:exit while
wend
if flag=ambig goto [quit]
d$=dname$+chr$(32)
dname$=""
k=1
while word$(d$,k)<>""
dname$=dname$+word$(d$,k)
k=k+1
wend
k=1
while word$(dlist$,k,chr$(32))<>""
print word$(dlist$,k,chr$(32));dname$
if upper$(word$(dlist$,k,chr$(32)))=upper$(dname$) then flag=old else flag=new
k=k+1
if flag=old then exit while
wend
if flag=new then dlist$=dlist$+dname$
name mf$ as tf$
open mf$ for output as#1
print#1,dlist$
close#1
kill tf$
f$=dname$
print f$
return
wait
'-------------------------------
[fname]
for i=1 to 3
a$(i)=word$(date$(),i)
next
a$=a$(2)
a$=mid$(a$,1,len(a$)-1)
t=time$("ms")
t$=str$(t)
fname$=f$+a$(3)+a$(1)+".txt"
return