# scriptWithFunction.py
# Purpose: Call three tools (to find avg. nearest neighbor, intersection, and get count)
#          Print the results from avg. nearest neighbor and get count without using a function.
# Usage: No script arguments needed.

import arcpy
baseDir = 'C:/gispy/'
arcpy.env.workspace = baseDir +'data/ch15/tester.gdb'
outputWorkspace = baseDir + 'scratch'
arcpy.env.overwriteOutput = True

res = arcpy.AverageNearestNeighbor_stats('schools')
resList = res.getMessages().split('\n')
for message in resList:
    if '...' not in message and 'Time:' not in message:
        print(message)

outFC = outputWorkspace + '/intersectOutput.shp'
   
arcpy.Intersect_analysis(['schools', 'workzones'], outFC)

res = arcpy.GetCount_management(outFC)
resList = res.getMessages().split('\n')
for message in resList:
    if '...' not in message and 'Time:' not in message:
        print(message)
