Okay, seemingly easy as pie for the most part. probably needs some more work as not all macros worked but here goes.
Code:
if buttonDetail.isPetButton then
spellName = GetPetActionInfo( button:GetID() );
spellType, spellId = spellName and GetSpellBookItemInfo( spellName, "pet" );
caster = UnitExists( "vehicle" ) and "vehicle" or "pet";
else
spellType, spellId = GetActionInfo( button.action );
spellName = spellId and GetSpellInfo( spellId );
caster = "player";
if spellType == "macro" then
spellName = spellId and GetMacroSpell( spellId );
end end
if spellId then
start, duration, enable = GetSpellCooldown( spellId );
end