Search for Keyword and Export

Goal: Loop through all results that contain a keyword of For Image and export the image shown to a directory.

You must specify the path in the first line.

Code:

path = "C:\\"
n = 0

for analysis in Model.Analyses:
    sol = analysis.Solution
    for sol_obj in sol.Children:
        if sol_obj.Name.Contains("For_Image"):
            n += 1
            sol_obj.Activate()
            Graphics.ExportImage(path + sol_obj.name + ".png")