I am going to assume that the script is necessary for some reason, so I would take one of two approaches:
(defun xattach4script (fName /)
(initdia)
(command "_xattach" fName)
);end defun
And then call it from the script as:
(xattach4script <<Add full file path here, but make sure that all \ are replaced with \\>>)
Alternatively, you could just call xattach directly from the script:
filedia
0
_xAttach
<<Filename>>
If you want the dialog box to appear, then just the _XAttach line would be applicable.