Dear ArcPy & Python Folk, I now find the relevant help section here:
'>http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Integrating_scripts_within_a_model/0...
which mentions setting up parameter properties on the script and then shows the use of the following example setup code: import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) tablePath = gp.GetParameterAsText(0)
But only provides just one example... Little bit of ArcPy Voodoo there...What exactly is "arcgisscripting" and where is this python module more fully documented?Is this still the best way to do things in ArcGIS 10.1? Where are there more examples of doing this? I can now alter my script as follows:import arcpy import sys, string, os, arcgisscripting gp = arcgisscripting.create(9.3) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Imagery")[0] lyr = arcpy.mapping.ListLayers(mxd, "High_resolution", df)[0] # Trying to get %output_value% as an in-script variable scriptVar = gp.GetParameterAsText(0) # Use the SelectLayerByAttribute tool to select and # zoom to the selection arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", "Area = '%output_value%'") df.zoomToSelectedFeatures() arcpy.RefreshActiveView() outfile = "test" + scriptVar + ".jpg" arcpy.mapping.ExportToJPEG(mxd, r"C:\Test\\" + outfile, df, df_export_width=1600, df_export_height=1200, world_file=True) # Clear the selection and refresh the active view arcpy.SelectLayerByAttribute_management(lyr, "CLEAR_SELECTION") arcpy.RefreshActiveView()
And I finally get a test1.jpg...test2.jpg...test3.jpgindicating the ModelBuilder %output_value% has been successfully passed to scriptVar one time also correctly zooming to the first polygon:)!!Many thanks for the advice. Ian