Dont think its possible to both cast and cancel in 1 press, always gonna need 2 key presses to do that.
Here's my spammable ice block macro (requires supermacro)
/script SpellStopCasting()
/script if not buffed("Ice Block", 'player') then cast("Ice Block") end