Not that it matters, but I liked the idea of the "improved?" version, where it checks if you can cast it. Would it be possible to check if you *did* cast it?
This is obviously untested, but here's the basic idea:
/script wasNotOnCooldown=(GetSpellCooldown(s)==0)
/cast Shield Wall
/script if (wasNotOnCooldown&& GetSpellCooldown(s)~=0) SendChatMessage...
Question is whether we can force a variable to be globally (or macro-level) bound from a /script call, and I don't remember the WoW-Lua variable bounding rules for macros...