home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 945.ZIP / CODESAFE.MCR next >
Encoding:
Text File  |  1997-03-02  |  3.3 KB  |  190 lines

  1. PROC macro:
  2. global e$(1),f$(30),k$(100,25),l$(100,25),m$(6),p$(8),s$(25),v$(30),q(8),n,m,o,r%,f%
  3.  
  4. rem ███████████████████████████████████████
  5. rem █ CodeSafe - ╕Huub Linthorst, 1997    █
  6. rem █ MacSys macro to store secret codes  █
  7. rem █ E-mail: linthors@chem.leidenuniv.nl █
  8. rem ███████████████████████████████████████
  9.  
  10. m$="window" rem Show mode (blink or window)
  11. e$="m"      rem drive containing JBMACFIX.OPO (if present)
  12. f$="loc::m:\wrd\codesafe.wrd" rem File for data export
  13.  
  14. v$="v.1.1 - ╕Huub Linthorst, 1997"
  15. useapp:("active")
  16. tomacro:
  17. dinit "CodeSafe "+v$
  18. dxinput p$,"Master password"
  19. if dialog
  20.     if len(p$)>0
  21.         tofront:
  22.         p$=mid$(p$+p$+p$+p$+p$+p$+p$+p$,1,8)
  23.         n=1
  24.         while n<9
  25.             q(n)=asc(mid$(p$,n,1))
  26.             n=n+1
  27.         endwh
  28.         p4:
  29.     endif
  30. endif
  31. tofront:
  32. endp
  33.  
  34. proc p2:
  35. p2::
  36. p9:
  37. giprint:("CodeSafe is loading definitions...")
  38. position 1
  39. while not eof
  40.     k$(pos)=D.k$
  41.     l$(pos)=D.l$
  42.     next
  43. endwh
  44. if f%=1
  45.     r%=1
  46.     lopen f$
  47.     lprint "FOR SECURITY, REMOVE THIS FILE ASAP !"
  48.     lprint ""
  49.     lprint ""
  50.     while r%<pos
  51.         lprint k$(r%)
  52.         p0:
  53.         lprint s$
  54.         lprint "───"
  55.         r%=r%+1
  56.     endwh
  57.     close
  58.     lclose
  59.     dinit:("")
  60.     dtext:("","CodeSafe printed data to file",2)
  61.     dtext:("",f$,$202)
  62.     dtext:("","",0)
  63.     dtext:("","FOR SECURITY, REMOVE THIS FILE ASAP !",$102)
  64.     dtext:("","",0)
  65.     dialog:
  66.     goto x::
  67. endif
  68.  
  69. dinit: ("View code   ("+num$(pos-1,3)+" entries)")
  70. dchoicea: (1,"",addr(k$()),pos-1)
  71. r%=dialog:
  72. close
  73. if r%<>0
  74.     p0:
  75. endif
  76. dinit: ("")
  77. if m$="window"
  78.     dtext: ("Description:",k$(r%),0)
  79.     dtext: ("Secret code:",s$,$200)
  80. else
  81.     giprint: ("Code: "+s$)
  82. endif
  83.     dtext: ("","View another code?",2)
  84.     dbuttons: ("Yes,%y,No,%n")
  85.     r%=dialog:
  86.     if r%=1
  87.         goto p2::
  88.     endif
  89. x::
  90. endp
  91.  
  92. proc p4:
  93. dinit:("CodeSafe")
  94. dbuttons:("View,%v,Add,%a,Open DB,%o,Print,%p")
  95. r%=dialog:
  96. if r%=1
  97.     p2:
  98. elseif r%=2
  99.     p3:
  100. elseif r%=3
  101.     if exist ("loc::"+e$+":\app\jbmacfix.opo")
  102.         runjb:("data","m:\dat\codesafe.dat",actpid%:)
  103.     else 
  104.         runappc:("data","m:\dat\codesafe.dat")
  105.     endif
  106. elseif r%=4
  107.     f%=1
  108.     p2:
  109. endif
  110. endp
  111.  
  112. proc p3:
  113. p3::
  114. k$(1)=""
  115. l$(1)=""
  116. dinit: ("Data entry")
  117. dedit: (addr(k$(1)),"Description",20)
  118. dtext: ("Secret code","",0)
  119. if dialog: and len(k$(1))>0
  120. else
  121.     goto x::
  122. endif
  123. dinit: ("Data entry")
  124. dtext: ("Description",k$(1),0)
  125. dedit: (addr(l$(1)),"Secret code",20)
  126. dialog:
  127. if l$(1)=p$
  128.     beep:(8,1000)
  129.     giprint: ("Master password may not be saved...")
  130. elseif len(k$(1))>0
  131.     r%=1
  132.     o=1
  133.     p0:
  134.     p9:
  135.     D.k$=k$(1)
  136.     D.l$=s$
  137.     append
  138.     close
  139.     giprint: ("Code saved...")
  140.     dinit: ("Store another code?")
  141.     dbuttons: ("Yes,%y,No,%n")
  142.     r%=dialog:
  143.     if r%=1
  144.         goto p3::
  145.     endif
  146. endif
  147. x::
  148. endp
  149.  
  150. proc p9:
  151. if exist ("loc::m:\dat\CodeSafe.dat")
  152.     open "loc::m:\dat\CodeSafe.dat",D,k$,l$
  153. else
  154.     create "loc::m:\dat\CodeSafe.dat",D,k$,l$
  155. endif
  156. return
  157. endp
  158.  
  159. proc p0:
  160. s$=""
  161. n=8
  162. m=1
  163. while m<=len(l$(r%))
  164.     if o=1
  165.         s$=s$+chr$((asc(mid$(l$(r%),m,1)))+q(n))
  166.     else
  167.         s$=s$+chr$((asc(mid$(l$(r%),m,1)))-q(n))
  168.     endif
  169.     m=m+1
  170.     n=n-1
  171.     if n=0
  172.         n=8
  173.     endif
  174. endwh
  175. return
  176. endp
  177.  
  178. proc runjb:(a$,f$,act%)
  179. rem ╕JBSoft 1996
  180. local buf%(128),name$(128),p%(6)
  181. name$="JBMSRS"
  182. pokew addr(buf%()),act%
  183. poke$ uadd(addr(buf%()),2),a$
  184. poke$ uadd(addr(buf%()),3+len(a$)),f$
  185. call($228b,0,255,6,addr(buf%()),addr(name$)+1)
  186. name$=parse$("jbmacfix.opo",cmd$(1),p%())
  187. runapp:(name$,"")
  188. endp
  189.  
  190.