Slice Modifier to animate

Hi,

I need help on this Script can some one please help me on this.
Any help will be would be great!. Thank you!...

fn slicex =
(
if $ != modpanel.setCurrentObject $
Then
$ == modPanel.setCurrentObject $
else
b = $
bb = (b.max-b.min).x
)

For i in Selection Do
(
$.Slice.SlicePlane.position = [bb,0,0]
)