Such a script will not get you banned. The W3Champions hotkey functionality actually runs similar to this. Many gaming keyboards and mouses offer similar functionality as well. It is far too unsophisticated to be detected. It only executes native keyboard inputs. That is far less excessive than for example overlays streamers use, which even rely on in-game memory to function the way they do.
I agree that this isn’t ideal: it prompts end users as a group to rely on non native functionality to the game to perform such commands. For some individuals that are invested enough to reach these forums it may however be a practical solution to the problem.