home *** CD-ROM | disk | FTP | other *** search
Wrap
rem ╔═════════════════════════════════════╗ rem ║ ExAb - ╕Huub Linthorst, 96-97 ║ rem ║ Macro to EXtend ABbreviations ║ rem ║ E-mail: linthors@chem.leidenuniv.nl ║ rem ╚═════════════════════════════════════╝ PROC macro: global a$(8),b$(30),c$(1),d$(11),e$(1),f$(20),g$(3),h$(1),l$(255),r$(2),s$(255),t$(3),v$(36),a%,i%,l%,r%,t v$="(1.8e) ─ ╕Huub Linthorst, 96-97" rem ───THE FOLLOWING LINES ASSIGN USER DEFINABLE VARIABLES─── c$="+" rem Whole text search indicator r$="/" rem Linefeed indicator h$=">" rem Extension chain indicator e$="M" rem JBMACFIX.OPO drive (if present) g$="Yes" rem Case sensitivity rem USE EITHER OF THE NEXT TWO LINES (put rem in front of the other) d$=gen$(day,2)+"-"+gen$(month,2)+"-"+gen$(year,4) rem date format 23-2-1997 rem d$=mid$(datim$,5,11) rem date format 23 Feb 1997 rem ───DO NOT CHANGE ANYTHING BELOW THIS LINE! (unless you're an expert)─── useapp:("active") a$=Pid2App$:(CurrPid%:) if a$="program" b$="EXABP" else b$="EXAB" endif sendkey:(left%,ctrl%+shift%,1) p1: if s$="" gettext$: goto x:: endif if s$=c$+c$ delete: a%=1 giprint:("ExAb will search whole text...") p2: else p3: endif x:: endp proc p3: if exist ("loc::m:\dat\"+b$+".DBF") trap open "loc::m:\dat\"+b$+".DBF",D,k$,l$ if err beep:(5,700) dinit:("Error: "+err$(err)) dtext:("","Database "+b$+" may be in use by other program",2) dtext:("","Do you want ExAb to try close the database?",2) dbuttons:("Yes,%y,No,%n") r%=dialog: if r%=1 usefile:(b$+".dbf") exit: useapp:(a$) p3: else right: endif endif last p4: else p6: endif endp proc p4: if s$=".?" delete: p10: if r%=0 goto x:: endif p4: elseif s$=".d" delete: puttext:(d$) goto x:: elseif s$=".t" delete: puttext:(mid$(datim$,17,8)) goto x:: else l$=lower$(mid$(s$,loc(s$,".")+1,3)) if l$="dbf" l$="Data" elseif l$="wrd" l$="Word" elseif l$="agn" l$="Agenda" elseif l$="spr" l$="Sheet" else l$="" goto c:: endif delete: if left$(s$,1)="." dinit:("ExAb will open "+l$+" file") dtext:("","",2) dedit:(addr(s$),"Enter filename",10) dtext:("","",$202) dtext:("","If not found, file will be created",2) r%=dialog: if r%=1 else goto z:: endif endif if loc(s$,".")>0 s$=left$(s$,loc(s$,".")-1) endif s$=left$(s$,8) if exist ("loc::"+e$+":\app\jbmacfix.opo") runjb:(l$,s$,actpid%:) else runappc:(l$,s$) return endif endif c:: if len(s$)>10 i%=1 s$=left$(s$,10) endif position 1 while (not eof) and (s$<>D.k$) next endwh if s$=D.k$ delete: p7: elseif (eof) and s$<>D.k$ if pos>101 beep:(8,600) giprint:("Maximum number reached...") goto z:: endif delete: f$=" , <Esc> = input new" p8: if r%<>0 p4: goto z:: else puttext:(s$) endif dinit:("Enter full text for '"+s$+"' (<┘ = "+r$+")") dedit:(addr(l$),s$,24) if i%=1 beep:(8,600) giprint:("Abbreviations 10 characters max.") endif if a%<>0 beep:(8,600) dtext:("","<Enter> continue '"+c$+"' search, <Esc> quit",2) endif r%=dialog: if r%=1 if l$="" goto x:: else D.l$=l$ D.k$=s$ append giprint:("Record no. "+num$(pos,3)+" appended...") tofront: delete: p7: endif else goto z:: endif endif t=t+1 if right$(l$,1)=h$ right: delete: sendkey:(left%,shift%+ctrl%,1) p1: p4: endif x:: i%=0 if a%<>0 right: if r%=1 and l$="" right: r%=0 goto y:: endif sendkey:(127,2,1) y:: a%=2 p2: endif z:: close right: endp proc p2: if a%=2 psion:(%g) goto y:: endif psion:(%f) sendtext:(c$) enter: y:: p1: if s$=c$ sendkey:(left%,ctrl%+shift%,1) else a%=0 goto x:: endif p1: l$="" if a%=1 p3: elseif a%=2 p4: endif x:: close beep:(8,600) giprint:("ExAb finished extending "+num$(t,4)+" abbreviations") endp proc p1: if srvpid%:<>currpid%: tomacro: tofront: endif if testsrv%:=0 if lower$(g$)="yes" s$=gettext$: else s$=lower$(gettext$:) endif return else return endif endp proc p5: append p7: esc: sendkey:(259,6,1) delete: return endp proc p6: giprint:("Welcome to ExAb, one moment please...") create "loc::m:\dat\"+b$+".DBF",D,k$,l$ rem ---This line and the lines down to the next rem-line contain on-line info and may be removed if exist ("loc::m:\wrd\exab"+mid$(v$,2,1)+mid$(v$,4,2)+".wrd") goto x:: endif s$="" runappc:("word","loc::m:\wrd\exab"+mid$(v$,2,1)+mid$(v$,4,2)+".wrd") sendkey:(260,12,1) enter: enter: D.k$="exab" D.l$="ExAb "+v$+r$+r$+"A Macro to EXtend ABbreviations"+r$+r$+"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" p5: sendkey:(259,6,13) delete: D.k$="help" D.l$="ExAb HELP"+r$+r$+"This is how ExAb works. Type an abbreviation, e.g. 'sy'. With the cursor behind 'sy', hit ExAb's hot-key (I use <Psion-Enter>). The macro will search database EXAB for 'sy'. hot-key.1>" p5: D.k$="hot-key.1" 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. hot-key.2>" p5: D.k$="hot-key.2" 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.3>" p5: D.k$="hot-key.3" D.l$=r$+"'Exabbing' on special codes '.t' and '.d' will stamp the time and date, respectively, while hot-keying on '.?' opens ExAb's information menu for quick reference. hot-key.4>" p5: D.k$="hot-key.4" D.l$=r$+r$+"Database EXAB, is automatically created during 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.5>" p5: enter: D.k$="hot-key.5" D.l$=r$+r$+"Now try ExAb yourself with sy" append close sendkey:(260,12,1) rem ---This line and the lines up to the previous rem-line may be removed x:: dinit:("Welcome to ExAb") dtext:("","ExAb has created database file EXAB.DBF to store your data.",2) dtext:("","Please read file EXAB.TXT, included in the ZIP file,",2) dtext:("","for the latest information on this version.",2) dtext:("","The present file (EXAB"+mid$(v$,2,1)+mid$(v$,4,2)+".WRD) was created for quick reference.",2) dtext:("","It is not essential for EXAB's functioning and may be deleted.",$202) dtext:("","Enjoy ExAb",2) dialog: p4: return endp proc p7: l$=D.l$ while loc(l$,r$)<>0 l$=left$(l$,(loc(l$,r$)-1))+chr$(000)+mid$(l$,(loc(l$,r$)+1),len(l$)) endwh puttext:(l$) return endp proc p8: local m1$(101,10),m$(101,43),q$(3) giprint:("ExAb is loading definitions...") position 1 while not eof m1$(pos)=D.k$ if len(D.l$)<21 q$="" else q$="..." endif m$(pos)=m1$(pos)+" ── "+left$(D.l$,20)+q$ next endwh if len(f$)>0 dinit:("Abbreviation '"+s$+"' not found") dtext:("","",0) dtext:("","Choose existing or input new extension",2) else dinit:("Choose ExAb definition ("+num$(pos-1,3)+")") dtext:("","",0) endif dchoicea:(1,"",addr(m$()),pos-1) dtext:("","",$200) dtext:("","<Enter> = paste"+f$+" extension",2) r%=dialog: if r%<>0 puttext:(" ") s$=m1$(r%) endif endp proc p10: dinit:("ExAb "+v$) dtext:("","Database: "+b$+".DBF",2) dbuttons:("List,%l,Codes,%c,Open DB,%o,Sort DB,%s,Info,%i") r%=dialog: if r%=1 p8: return elseif r%=3 if exist ("loc::"+e$+":\app\jbmacfix.opo") runjb:("Data","m:\dat\"+b$+".dbf",actpid%:) else close runappc:("Data","m:\dat\"+b$+".dbf") goto x:: endif elseif r%=4 p9: elseif r%=2 dinit:("ExAb special codes") dtext:(".d","Stamp date ("+d$+")",$400) dtext:(".t","Stamp time ("+(mid$(datim$,17,8))+")",$400) dtext:(".?","Present Info menu",$400) dtext:(".dbf","Open Data file",$400) dtext:(".wrd","Open Word file",$400) dtext:(".agn","Open Agenda file",$400) dtext:(".spr","Open Sheet file",$600) dtext:("exab","ExAb introduction",$400) r%=dialog: if r%=2 s$=".d" elseif r%=3 s$=".t" elseif r%=4 s$=".?" elseif r%=5 s$=".dbf" elseif r%=6 s$=".wrd" elseif r%=7 s$=".agn" elseif r%=8 s$=".spr" elseif r%=9 s$="exab" else goto x:: endif puttext:(" ") r%=0 p4: elseif r%=5 dinit:("ExAb configuration") dtext:("Whole text search indicator",c$,2) dtext:("Linefeed indicator",r$,2) dtext:("Extension chain indicator",h$,2) dtext:("JBMACFIX.OPO drive",e$,2) dtext:("Case sensitivity",g$,2) dtext:("Date format",d$,$202) dtext:("","Change these settings by editing EXAB.MCR",2) dialog: dinit:("ExAb "+v$) dtext:("","If you like ExAb and wish to receive free updates,",2) dtext:("","have your name added to my ExAb user list.",2) dtext:("","E-mail me at linthors@chem.leidenuniv.nl",2) dialog: else x:: s$="" endif r%=0 endp proc testsrv%: local wsrv$(15),in%(6),fmt&,pid%,pfmt% wsrv$="sys$wsrv.*"+chr$(0) in%(1)=$100 in%(2)=uadd(addr(wsrv$),1) if os($88,addr(in%(1))) and 1 return(in%(1) and $ff)-$100 else pid%=in%(1) endif pfmt%=addr(fmt&) if call($683,pid%,4,0,addr(pfmt%),0)<=0 return -33 endif if (fmt& and $16)=0 return -36 endif endp proc runjb:(a$,f$,act%) rem ╕JBSoft 1996 local buf%(128),name$(128),p%(6) close name$="JBMSRS" pokew addr(buf%()),act% poke$ uadd(addr(buf%()),2),a$ poke$ uadd(addr(buf%()),3+len(a$)),f$ call($228b,0,255,6,addr(buf%()),addr(name$)+1) name$=parse$("jbmacfix.opo",cmd$(1),p%()) runapp:(name$,"") endp proc p9: local z%,g$(10),g%,lp%,n$(128),c% last z%=pos if count>7 tomacro: busy "Sorting database...",0 while z%>0 position z% g%=pos g$=upper$(D.k$) do if upper$(D.k$)<g$ g$=upper$(D.k$) g%=pos endif lp%=pos back until pos=1 and lp%=1 position g% print g$ update z%=z%-1 endwh endif close tofront: busy off beep:(6,500) giprint:("Database sorted. Thanks for waiting...") endp