ArcGIS for Desktop 10.3.0.4322
I have a script tool which requires a parameter (folder path to a gdB, via
GetParameterAsText) so that a later process can be saved there. The thing I want to do is make an Optional Boolean parameter, that when checked, automatically fills in the folder path gdB parameter. The boolean text asks the user, "Use default workspace?", to which if they check the box (boolean == True), then the folder path parameter will be automatically defaulted (saving the user a small amount of time). I have already created the boolean parameter in the script tool, I am however unaware of how to "fill in" the required parameter based on the user's boolean.
# Ask user to select the Geodatabase workspace to use for data output userWorkspace = arcpy.GetParameterAsText(0) # Ask user if they want to use default workspace (boolean) useDefault = arcpy.GetParameterAsText(1) # If user wants default workspace, then give it to the required parameter (0) if useDefault == True: arcpy.env.workspace = path else: # Set workspace environment based upon user's choice arcpy.env.workspace = userWorkspace