Use of abbreviations in scripts
Kay C Lan
lan.kc.macmail at gmail.com
Fri Oct 20 03:22:12 CDT 2006
I'm very much in both camps. I need to be verbose in my scripts so
that months down the track I can easily interpret what I've done. But
I like to use abbrevs because I'm lysdexic, I have a claim on the
world's worst speller trophy topped off by the fact that I'm not that
flash at typing. The fact that I only have a little time that I can
devote to scripting is the least of my worries. How blessed I am to be
born in the day of computers with spell & syntax checkers.
Anyway I overcame this apparent Catch 22 with CopyPaste:
http://www.scriptsoftware.com/copypaste/ - Mac and Windows.
I've used CopyPaste for years and believe that it should be built into
the OS. 10 clipboards, unlimited remembering of 'Copies' performed,
set up clip sets for different programs. It's great.
Then a while back they added yType which just adds to it's brilliance.
Basically it 'intelligently' guesses what you are going to type and
'offers' to type it for you. Best of all you can set up
autocorrections and boilerplates.
Autocorrections are just that, you enter a list of words how you
normally mistype them, and their corresponding corrections:
crad => card
feild => field
windwo => window
teh => the
hilight => hilite
textColour => textColor
every time you type the left hand word, yType will automatically
replace it with the correct spelling - you don't do a thing. Of course
you can easily cheat and set it up to include:
cd => card
cds => cards
fld => field
bkg => background
Boilerplates are abbrevs or acronyms you enter and what you'd like
typed in their place:
mycomp => 25MHz 030 IIci
32MB RAM 40MB SCSI HD
ygtbjr => you've got to be joking, right!
tmyolc => tMyOuterLoopCounter
tmyilc => tMyInnerLoopCounter
tmyvdhn => tMyVeryDescriptiveHandlerName
tmyvdfn => tMyVeryDescriptiveFunctionName
tmyvdvn => tMyVeryDescriptiveVariableName
osvlsn => of stack "Very Long Stack Name"
if90th => if () then
switch => switch
answer "You shouldn't have got here"
For these boilerplates to work, as with any autocompletion, you type
in the preset minimum number of letters (I use 4), followed by two
spacebars, yType will then replace the abbrev with your desired
This would all be perfect except for one major and one minor problem.
The major problem is that CopyPaste works perfectly with every program
I use it with, except one - Rev:-(
I assume it has something to do with Rev's 'event' based mechanism,
which is what CopyPaste uses as well. CopyPaste works as advertised in
Rev until you do your first 'Copy' after which any autocompletions or
boilerplates will be usurped by whatever is in the clipboard. I tried
using it with Galaxy, and although it doesn't suffer the same problem
as the Rev Script Editor, when an autocompletion/boilerplate is
triggered, a little box is suppose to pop up with one or more
suggestions. In the above example, tmyv should pop up a box with three
possibilities so you can click on one. In Galaxy that doesn't happen
so you evoke the autocomplete 'blind' but can often get a different
'result' than you were expecting - thereby negating any attempt at
saving typing strokes.
The one 'minor' problem with CopyPaste + yType is that it only has one
'yTypeSuggestion.txt' file which stores every word you type plus your
boilerplates. Basically it keeps track of how often you type a word
and when your paramaters are met it lists in order of frequency all
possible autocompletions. Boilerplates are just words you force into
this list which are given a very high number so they will always
appear at the top of any autocompletion suggestion list. This can be a
little annoying as scripting in Rev has different words appear more
often than AppleScript, Perl or HTML and when you return to Mail or
regular word processing, you get all sorts of undesirable suggestions.
I was able to work around this by writing an AppleScript that created
my own text files, basically one for each project/program, and on
request move the file to the default location and rename it to
If CopyPaste +yType worked reliably in Rev, with intelligent use of
autocorrection and boilerplates I reckon I could have very english
like scripts of which only half the keystrokes I actually typed.
I live in hope that when Rev solve their "Copy & Paste keyboard
short-cut occasionally not working" anomaly, that CopyPaste +yType
will then work flawlessly with Rev:-)
More information about the use-livecode