You can use the 3DX Script adapter to run a 3DX script that operates on a selected object.
About the 3DX Script Adapter Configuring the 3DX Script Adapter