def runTrackingScriptOnDirectory(directory, d0, pPmm, rotation, yTop, yBottom, xRight, xLeft, twoCapsules=0, OpenCV3=1):
    print('Starting function "runTrackingScriptOnDirectory"')

    fpss = [10, 11, 20, 25, 30, 40, 50, 60, 70, 80, 100, 120, 140]
    # fpss=[6, 10, 14, 20, 25, 30, 35, 40]

    problems1 = []
    for fps in fpss:
        try:
            backPath = directory + "Background" + str(fps) + "FPS.png"
            a = tr.userInputClass(directory, "", d0, pPmm, rotation, fps, yTop, yBottom, xRight, xLeft, backPath)
            tr.runOneFPS(parameters=a, FPS=fps, twoCapsules=twoCapsules, OpenCV3=OpenCV3)
            problems1.append("%d Completed! " % fps)
        except:
            problems1.append("\t\t%d didn't complete" % fps)

    print(problems1)
#path=directory + folder

#print(os.path.exists('M:\\EdgarHaener\\Capsules\\Batch120615-004\\T-Junction\\Background30FPS.png'))

backPath = directory +'Background%dFPS.png' %FPS
#backPath = path[:d]+'\\BackgroundStatic.png'

#a = tr.userInputClass(directory, folder, 3.9, 22.3, -0.3, FPS, 37, 121, 535, 709, backPath) #GelBeads150715-1 #4
#a = tr.userInputClass(directory, folder, 2.7, 22.4, -0.3, FPS, 32, 119, 537, 712, backPath) #GelBeads150730-1 #2
#a = tr.userInputClass(directory, folder, 3.8, 22.4, -0.3, FPS, 35, 118, 549,  724, backPath) #Batch120615-004-#5 All excepte 15ml/min
#a = tr.userInputClass(directory, folder, 3.8, 22.2, -0.3, 30, 72, 160, 550, 725, backPath) #Batch120615-004-#5 15ml/min
#a = tr.userInputClass(directory, folder, 3.9, 22.2, -0.3, FPS, 38, 122, 549, 722, backPath) #Batch040615-002-#1
#a = tr.userInputClass(directory, folder, 4.5, 22.5, -0.3, FPS, 35, 120, 535, 711, backPath) #Batch270715-001-#5
#a = tr.userInputClass(directory, folder, 3.7, 22.6, -0.3, FPS, 33, 119, 540, 716, backPath) #Batch100815-001-#8
#a = tr.userInputClass(directory, folder, 3.7, 20.2, -0.3, FPS, 23, 105, 550, 716, backPath) #Batch100815-001-#6-7
a = tr.userInputClass(directory, folder, 3.8, 22.3, -0.3, FPS, 28, 114, 559, 733, backPath) #Batch260615-001-#17

#tr.find_max_extend(path, d0=3.7, pPmm=22.3, background=backPath, rotate=-0.3, plot=False, threshold=130, printDebugInfo=False, denoising = False, geomTJ=[25, 121, 535, 709])
#tr.runOneFPS(directory, d0=3.7,  pPmm=22.3, FPS=70, rotateImages=-0.3, threshold=130, background=backPath)
#tr.runScript(parameterClass=a, plot=False, debugInfo=False, twoCapsules=False, OpenCV3=False)
tr.runOneFPS(parameters=a, FPS=50, twoCapsules=False, OpenCV3=False)


#fpss=[40, 60, 70, 100, 120, 140]
#problems1=[]
#for fps in fpss:
#    try:
#        backPath = directory +'Background'+str(fps)+'FPS.png'
#        a = tr.userInputClass(directory, folder, 3.8, 22.3, -0.3, fps, 25, 114, 559, 733, backPath)
#        tr.runOneFPS(parameters=a, FPS=fps)
#    except: