Mage macro

Hi guys , can u help me with a macro which includes AP / ZHC/ PoM.When i tried to use a macro with these tree AP just vanish. 

/run UseInventoryItem(13)
/run i=1 b=false while(UnitBuff("player",i)~=nil) do b=b or strfind(UnitBuff("player",i),"Nature_Lightning") i=i+1 end if not b then CastSpellByName("Arcane Power") end
/cast Presence of Mind
/cast Frostbolt