I can not run this script when is a button

hi every one i hope we can solve this problem

im new here and im learning scripting sorry if it is easy to solve:S
i wrote this scriptto mirror morph targets and it works, but when i select the code and drag to the maintoolbar like a button it wont work anymore.
this is the code:

objectDeformed=selection[2]
ObjectOriginal=selection[1]
a=snapshot ObjectOriginal
M=morpher()
addmodifier a M
WM3_MC_BuildFromNode M 1 ObjectDeformed
addmodifier a (mirror())
a.position=ObjectDeformed.position
b=snapshot ObjectDeformed
Def=skin_wrap()
addmodifier b Def
Def.meshList=#(a)
Def.falloff =0.01
Def.Distance=0.01
a.Morpher[1].value=100
convertTo b Editable_Poly
delete a