i make script about sweep... please help

I want some lines apply to sweep modifier.
but error code is not correct work.
Why this script don`t work.
error code
please help me
--------------------------------------------------------
-- Error occurred in btn1.pressed(); filename: C:\Users\kh\Desktop\button.ms; position: 245
-- Frame:
-- z: sweep:Sweep
-- b: 50
-- i: $selection
-- a: 100
>> MAXScript Rollout Handler Exception: -- No ""get"" function for undefined <<

----------------------------------------------------------

rollout kkk "Untitled" width:145 height:63
(
button btn1 "Button" pos:[35,21] width:56 height:20
on btn1 pressed do
(
i=$

z=sweep()

addmodifier i z

z.currentbuiltinshape=2

a=100

b=50

getsubanim i[1][4][1][4][8]

i[1][4][1][4][8].value=a

i[1][4][1][4][9].value=b

z.smoothpath=off
)
)
createdialog kkk