Since I don't have it, I can't give tell you if it has full AppleScript support (I don't think it did 9 years ago) but the first thing you should do, and can do, is launch Pro Tools, then launch the KM Editor, then create the following button in a new KM macro:
Then use the down arrow near the rightmost "Button" label in the action. Then select Pro Tools. Then use the same down arrow a second time, and see if the names of those buttons that you want to select are visible in the list. If the answer is yes, you can be very happy, and there will be a simple answer.
The default shortcut for the Selector Tool (second image) is Cmd+3 (the 3 above the E, not the 3 in the numeric pad). For the Smart Tool it's Cmd+7.
For both, just assign the keystroke you want in PT's Keyboard Shortcut window.
'Dumb' Switching using a global variable. This will be fast and easy to set up, set a 'toggle' variable with an if statement where depending on the state of the variable keyboard maestro triggers one of 2 hotkeys to switch to the other tool.
The problem with this method is that this doesn't account for situations where the variable state gets out of sync with the actual status of the tool in the software. You'd have to either implement some sort of "reset", or manually toggle the tool when things get "out of sync" Not so terrible, but could get annoying.
The other method i'd look into reading the status of the edit tool via applescript, and then triggering the appropriate hotkey depending on the current state. This will be more consistent, but a little trickier to make.