glenreid

PYT: Copy parameter

Discussion created by glenreid on Feb 28, 2013
Latest reply on Feb 28, 2013 by glenreid
In a Python Toolbox, I ask the user for 2 parameters, an input and output mxd:

    def getParameterInfo(self):
        """Define parameter definitions"""

        param0 = arcpy.Parameter(
            displayName="Input ArcMap Document",
            name="in_mxd",
            datatype="DEMapDocument",
            parameterType="Required",
            direction="Input")

        param1 = arcpy.Parameter(
            displayName="Output ArcMap Document",
            name="out_mxd",
            datatype="DEMapDocument",
            parameterType="Required",
            direction="Output")


After the user selects the first, I'd like to copy the input mxd path to the second parameter, something like this:

c:\temp\test.mxd

c:\temp\testCopy.mxd

I'm working in updateParameters, without success:

    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""

 if self.params[0].value:
     self.params[1].value = self.params[0].value

        return



Thanks,
Glen

Outcomes