Archive for January 5th, 2007

gaim_add2dict

This script adds an "autocorrect" definition inside of a text file. The def will look like:

COMPLETE: 1
CASE: 0
BAD: misspelling
GOOD: fixed_spelling

This helps prevent typos in Gaim. If you want to access the script from directly within gaim, you can use the gaim-slashexec plugin (this is the src tarball; the guifications site is down) and just use the /exec command from inside gaim.

BASH:
  1. #!/bin/bash
  2. # will add a def to dict file (for gaim autocorrect)
  3. PROGN=gaim_add2dict
  4. # script takes 2 args, BAD word followed by GOOD word
  5. # where is your dict?
  6. GAIM_DICT_FILE=/path/to/my/dict/file
  7.  
  8. if [ $# -ne 2 ]; then
  9.         echo "error: $PROGN: I need 2 args, please..."
  10.         exit 1
  11. else #exactly 2 args
  12.         BADWORD=$1
  13.         GOODWORD=$2
  14.         BAD_EXISTS_TEST=`grep -cx "BAD $BADWORD" $GAIM_DICT_FILE` # 1 if line exists
  15.         if [ $BAD_EXISTS_TEST -ne 0 ]; then 
  16.                 echo "error: $PROGN: BAD $BADWORD already exists in $GAIM_DICT_FILE"
  17.                 exit 1       
  18.         fi
  19. echo -e "\nCOMPLETE 1\nCASE 0\nBAD $BADWORD\nGOOD $GOODWORD\n" | cat ->> $GAIM_DICT_FILE && echo 'the definition has been added (does this message make it thru?'
  20. fi
  21. exit 0

1 comment January 5th, 2007


Calendar

January 2007
M T W T F S S
« Nov    
1234567
891011121314
15161718192021
22232425262728
293031  

Posts by Month

Posts by Category