home *** CD-ROM | disk | FTP | other *** search
EPOC OPL Source | 1998-10-28 | 2.3 KB | 89 lines |
-
-
- rem // Backlite+Plus Macro - macShortcut V1.0 by J.Kneen 30/1/98
- rem // This macro replaces a typed code with a long text string based on a database file.
- rem // The file is a standard EPOC data file and can be edited using Data, or through
- rem // the settings dialog (which launches data and waits until finished)
-
- rem // With a little work, this macro could form the basis of an address book for the
- rem // messaging software.
- rem // by linking to an existing database, and only accessing the fields required, you
- rem // could type an abbreviation code, and it would be replaced by the email address.
-
- PROC macShortcut:
- Local c$(255),l%,a$(255),strfile$(255), d$(255)
-
- rem // Highlight the last word typed.//
- BLSwitchtoCurrent:
- BLKeycommand:("CTRL+LEFT")
- BLKeycommand:("SHIFT+CTRL+RIGHT")
-
- rem // Get the settings for the datafile and copy the selected //
- rem // text into c$ //
- strFile$=BLLoadSetting$:("ShortcutFile")
- c$=BLCopy$:
-
- WHILE RIGHT$(c$,1)=" "
- c$=LEFT$(c$,LEN(c$)-1)
- ENDWH
-
- d$=c$
-
-
- rem // Check for empty file //
- IF strFile$=""
- RETURN
- ENDIF
-
- rem // Open the file and find the code //
- OPEN """"+strfile$+"""",A,field1$,field2$
- FIRST
- WHILE NOT EOF
- IF A.field1$=c$
- c$=A.field2$
- BREAK
- ELSE
- NEXT
- ENDIF
- ENDWH
- CLOSE
-
- rem // Paste the result if it has changed.
- IF d$<>c$
- BLPasteText:(c$)
- ENDIF
-
- ENDP
-
-
- PROC macShortcutSettings:
- LOCAL d%,strfile$(255)
-
- strFile$=BLLoadSetting$:("ShortcutFile")
-
- rem // Main settings dialog //
- dINIT "Shortcut Macro Settings",16
- dBUTTONS "Data File",%f,"Add/Edit entries",%e,"Close",13
- d%=DIALOG
-
- rem // If Edit, switch to the Database and wait for the user to finish //
-
- IF d%=%e
- BLSwitchto:(strFile$)
- BLWaitforFileExit:("Waiting to exit Shortcut database...")
- BLBacklitetoFront:
- rem // If File, display a config dialog to select a database.
-
- ELSEIF d%=%f
- dINIT "Database file"
- dFILE strfile$,"File,Folder,Disk",2
- dBUTTONS "Cancel",27,"OK",13
- IF DIALOG=13
- BLSaveSetting:("ShortcutFile",strfile$)
- ENDIF
- ENDIF
- ENDP
-
-
-
-