def postLogbook(logbookName,logbookText,pCode): 
        logbookText='Tomcat MS Script:\n'+os.path.expandvars('$HOME')+'\n'+logbookText
        if logbookEnabled:
            X_ROBOT_X02DA_logbook.writeReconLog(logbookName,logbookText,pCode)
# Make sure no other instances are running
activeDBtasks = X_ROBOT_X02DA_robotCommon.CheckSequencer()
if activeDBtasks > 0:
    print activeDBtasks
    print os.getpid()
if len(activeDBtasks) > 1:
    print "Error : Another instance of the sequencer is already running!!"
    X_ROBOT_X02DA_robotCommon.xWinMsg("Another sequencer is already running!")
    sys.exit(1)


dbClass = dbSequence(debugMode, opt.expert, opt.checkbeam)


dbClass.myRobotScript.loadText(scriptText, trayToDict(cTray))
dbClass.myRobotScript.validateSequenceGUI()
dbClass.myRobotScript.skipList = skiplines
if dbClass.myRobotScript.fatalError == 0:
    logbookText += "Script:\n" + str(scriptText) + "\n"
    nDict = trayToDict(cTray)
    logbookText += "Tray Contents:\n" + "\n".join(map(str, nDict.items())) + "\n"
    if logbookEnabled:
        X_ROBOT_X02DA_logbook.writeEntry(logbookName, logbookText)

    imageLog = dbClass.myRobotScript.executeScript(dbDelay=0)

    logbookText = str(imageLog)
    if logbookEnabled:
        X_ROBOT_X02DA_logbook.writeEntry("Completed : " + logbookName, logbookText)