You can use two Scripts or one Script that, depending on some predetermined factor, performs two different tasks.
So you could for example write something into the metadata, a channel, a txt file, … when a Script is run and that information is absent, and if it isn’t have the Script perform something else and remove that again.
Edit: You probably could also set up the Script Events Manager to check for something on any Selection change and have it run a Script depending on that but I doubt that’s a good idea.
Found this searching and had a chuckle with Adobe staff (maybe that happened later?) asking forums how to do things