I found one /script macro here that does something let's say close enough but it is not what I need. I tried to edit it but with no luck.
Basically, I need a macro that is gonna check for the exact item in my inventory, and if there is none it's gonna use a spell that gives that exact item. So basically one button for the same thing.
If there is item (use it), if there is no item in bag (spell to make it).
There isn't a macro condition for that. What I tend to do is write a macro like this.
Code:
/cast [btn:1] ItemName; SpellName
This makes left-clicking the button use the item and right-clicking will create it.
Of course, replace ItemName and SpellName with the names of the actual item and creation spell.