Script to confirm item use?

so I’m trying to keep from wasting consumables and thought, “wouldn’t it be nice if I could get a popup to ask whether I really wanted to use the item?” so I searched for all the necessary bits and pieces and came up with this:

#showtooltip 0 1
/script i = select(2, GameTooltip:GetItem()) StaticPopupDialogs[“C”] = {text = i … GetUnitName(“target”), button1 = “Y”, button2 = “N”, OnAccept = function() UseContainerItem(0,1) end, hideOnEscape = true} StaticPopup_Show (“C”)

but I get an error that “A macro script has been blocked from an action only available to the Blizzard UI”

I’m wondering why this doesn’t work, but the common “sell all gray items” macro can call the UseContainerItem() without issue

The buttons on the StaticPopups are not secure

<Button name="StaticPopupButtonTemplate" virtual="true">