home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 909 / EXAB.MCR next >
Encoding:
Text File  |  1997-01-30  |  3.5 KB  |  151 lines

  1. rem - ExAb - ╕Huub Linthorst, 96-97
  2. rem - Based on an idea of Ben Clifford
  3. rem - MacSys macro to EXtend ABbreviations
  4. rem - from a self-maintained database
  5. rem - E-mail: linthors@chem.leidenuniv.nl
  6.  
  7. PROC macro:
  8. global db$(30),s$(255),str$(255),r%,nv$(35),a%,c$(1)
  9. c$="/"
  10. nv$="ExAb v.1.5 - ╕Huub Linthorst, 96-97"
  11.  
  12. useapp:("active")
  13. if Pid2App$:(CurrPid%:)= "Program"
  14.     db$="EXABP"
  15. else 
  16.     db$="EXAB"
  17. endif
  18. sendkey:(left%,ctrl%+shift%,1)
  19. srv:
  20. if s$=c$+c$
  21.     delete:
  22.     a%=1
  23.     giprint:("ExAb will search whole text...")
  24.     all:
  25. else start:
  26. endif
  27. endp
  28.  
  29. proc start:
  30. if not exist ("\dat\"+db$+".dbf")
  31.     giprint:("Welcome. ExAb will create database "+db$+"...")
  32.     create "\dat\"+db$+".dbf",D,k$,l$
  33.  
  34. rem ---This line and the lines down to the next rem-line contain on-line info and may be removed
  35.  
  36.     D.k$="exab"
  37.     D.l$=nv$+" - a MacSys macro to EXtend ABbreviations. E-Mail me for comments, suggestions and improvements at linthors@chem.leidenuniv.nl. With the cursor behind the word help, hit the hot key again to get help"
  38.     append
  39.     D.k$="help"
  40.     D.l$="ExAb HELP. This is how ExAb works. Type in an abbreviation, e.g. 'sy'. With the cursor still behind 'sy', hit ExAb's hot-key (I use <Psion-Enter>). The macro will search database EXAB for 'sy'. ...at.the.end.of.this.line.hit.the.hot-key.again..."
  41.     append
  42.     D.k$="...at.the.end.of.this.line.hit.the.hot-key.again..."
  43.     D.l$="If found, ExAb will replace 'sy' in your text with the corresponding full text. If not found, ExAb will present an input screen to enable you to add 'Sincerely Yours,' or 'Since Yesterday' to the database. ...same.trick.for.more.info..."
  44.     append
  45.     D.k$="...same.trick.for.more.info..."
  46.     D.l$="Alternatively, ExAb can search and replace all abbreviations of a text in one go. Therefore, type a '"+c$+"' at the end of each abbreviation. After finishing type '"+c$+c$+"' at the start of the text followed by the hot-key. ...hot-key.again..."
  47.     append
  48.     D.k$="...hot-key.again..."
  49.     D.l$="Database EXAB, is automatically created after installation. It contains these help lines and the abbreviations and extensions that you add during - a hopefully enjoyable - use. Using DATA, you can modify EXAB.DBF. ...hot-key.once.more..."
  50.     append
  51.     D.k$="...hot-key.once.more..."
  52.     D.l$="Now try ExAb yourself with sy"
  53.     append
  54.  
  55. rem ---This line and the lines up to the previous rem-line may be removed
  56.  
  57. else
  58.     open "\dat\"+db$+".dbf",D,k$,l$
  59. endif
  60. start2:
  61. endp
  62.  
  63. proc start2:
  64. if s$=".d"
  65.     delete:
  66.     PutText:(mid$(datim$,5,11))
  67.     goto esc::
  68. endif
  69. if s$=".t"
  70.     delete:
  71.     PutText:(mid$(datim$,17,5))
  72.     goto esc::
  73. endif
  74.  
  75. position 1
  76. while (not eof) and (s$<>D.k$)
  77.     next
  78. endwh
  79. if s$=D.k$
  80.     delete:
  81.     puttext:(D.l$)
  82. elseif (eof) and s$<>D.k$
  83.     dinit:(nv$)
  84.     dtext:("","Enter full text for '"+s$+"'",2)
  85.     dedit:(addr(str$),s$,24)
  86.     if a%<>0
  87.         dtext:("","<Esc> remove '"+c$+"'   <Enter> keep '"+c$+"'",2)
  88.     endif
  89.     r%=Dialog:
  90.     if r%=1
  91.         if str$=""
  92.             goto esc::
  93.         else
  94.             D.l$=str$
  95.             D.k$=s$
  96.             append
  97.             tofront:
  98.             delete:
  99.             puttext:(D.l$)
  100.         endif
  101.     endif
  102. endif
  103. esc::
  104. if a%<>0
  105.     right:
  106.     if r%=1 and str$=""
  107.         right:
  108.         r%=0
  109.         goto nodel::
  110.     endif
  111.     sendkey:(127,2,1)
  112.     nodel::
  113.     a%=2
  114.     all:
  115. endif
  116. close
  117. right:
  118. endp
  119.  
  120. proc all:
  121. psion:(%f)
  122. sendtext:(c$)
  123. enter:
  124. srv:
  125. if s$=c$
  126.     sendkey:(259,6,1)
  127.     else
  128.     a%=0
  129.     giprint:("ExAb has finished...")
  130.     goto quit::
  131. endif
  132. srv:
  133. if a%=1
  134.     start:
  135. endif
  136. if a%=2
  137.     start2:
  138. endif
  139. quit::
  140. close
  141. ENDP
  142.  
  143. proc srv:
  144. if currpid%:<>srvpid%:
  145.     tomacro:
  146.     tofront:
  147. endif
  148. s$=gettext$:
  149. return
  150. endp
  151.