news |
info |
people |
software |
stuff |
This routine can be used to implement "smart" quote characters in text fields. This is done by putting the script
on keyDown k UL_SmartQuote k end keyDown
into the field.
With the above script in a field, when
on UL_SmartQuote key get the selectedChunk subtract 1 from word 2 of it delete word 3 to 4 of it put value(it) into lastKey if key is "'" then put "'" into key else if key is quote then if (lastKey is space) or (lastKey is return) then put """ into key else put """ into key end if else if key is """ then put quote into key else if key is "'" then put "'" into key end if keydown key end UL_SmartQuote