Some time ago I posted a script that turned the touchpad on and off as needed. This script disabled the touchpad when I using a mouse. After using it for sometime I found that occasionally the device numbers changed after a reboot. So I modified the script to use the device name in place of the ID.
The original post, now updated, is here.