I think that in order to automatically know the name of the current view you would need custom code.
You could use qRules, but knowing more about the scenario would help to know whether qRules can help, or whether you're better off writing custom code.