Good stuff Peter.
I guess the challenge is in dealing with a range of different switch types, with different numbers of ports, but your method of using ranges helps a bit.
After all, there's only a certain number of different combinations. Most switches will be handled by just a few combinations, and you can deal with the rest manually.
Another option might be to use the eAPI, but that could take a bit of work working out your code. Depends how many switches you need to configure.
A further option might be to use the global command "undo snmp-agent trap enable standard linkup linkdown"
I'm not 100% certain, but if you do that, you might be able to then go and enable traps on specific interfaces.