No announcement yet.

CMax button doesn't work.

  • Filter
  • Time
  • Show
Clear All
new posts

    CMax button doesn't work.

    With all my playing around trying to get my relays working, I have managed to hose my Cmax button on the setup page. It no longer disconnects the com port and brings up the CPUXa program, and the script ADIOcelot_CMAXSnyc.txt is not run. I must have screwed up the path, although everything is pointing to the correct directory.

    If I disable the ADIOcelot plugin, and bring up CPUXa, everything works.

    Being able to move between the two programs is a great feature and I'd love to be able to take advantage of it.

    As an aside, calling up the ADIOcelot plugin setup program from the Interfaces page works, although it is sometimes hidden behind other windows, but calling the setup program from the Homeseer title bar, locks everything up.


    I do not have ocelot connected to HS so no testing possible. Below is the sequence of code related to this function. Perhaps it will give you some clues. Line 2530 is where CMAX is invoked and the process where ADIOCelot runs should be blocked until CMAX closes down. Note that in line 30 & 50 of aCMAX_Click there is a check for a user-entered filename to be present and if not it will ignore the CMAX button

    Private Sub aCMAX_Click()
    10        On Error GoTo Error_Exit
              Dim fso As Object
    20        Set fso = CreateObject("Scripting.FileSystemObject")
    30        If Not fso.FileExists(aCMAXexe.Text) Then
    40            aCMAXexe_Click
    50            If Dialog.filename = "" Then
    60               GoTo Normal_Exit
    70            End If
    80        End If
              'Flag to request comm port released and to spawn out CMAX
    90        hs.RunEx "ADIOcelot_CMAXSync.txt", "BeforeCMAX", ""
    100       gCloseCommPort = True
    110       gCMAXLoaded = True
    120       LabelDisconnectButton
    130       Set fso = Nothing
    140       Exit Sub
    150       hsWritelog PLUGIN_NAME, "aCMAX_Click"
    160       Resume Normal_Exit
    End Sub
    Private Sub aCMAXexe_Click() 
    10        If Not bIgnoreChange Then
    20           Dialog.Filter = "cpuxa.exe|cpuxa.exe"
    30           Dialog.Flags = cdlOFNFileMustExist Or cdlOFNLongNames
    40           Dialog.ShowOpen
    50           If Dialog.filename <> "" Then
    60                bIgnoreChange = True
    70                aCMAXexe.Text = Dialog.filename
    80                SaveCMAXexePath
    90                bIgnoreChange = False
    100          End If
    110       End If
    End Sub
              ' if user requested comm port to be closed then do
              ' if user requested cmax to be run then spawn it
              ' Update status dot on setup page if the page is showing
    2430      If gCloseCommPort Then
    2440          Timer2.Enabled = False
    2450          Timer3.Enabled = False
    2460          FrmTimer.MSComm1.PortOpen = False
    2470          gPortOpen = False
    2480          If gSetupFormShowing Then
    2490              FrmConfig.PortOpen = False
    2500          End If
    2510          If gCMAXLoaded Then
    2520              With FrmConfig
                          'Run cmax and wait till done .. trying to pass project file as parameter was ignored by CMAX
    2530                  CreateObject("WScript.Shell").Run q & .aCMAXexe.Text & q, 1, WAIT_TIL_DONE  '& " " & q & aProjectFile.Text & q
    2540                  gCMAXLoaded = False
    2550                  If gSetupFormShowing Then
    2560                      .Disconnect_Click
    2570                  Else
    2580                      gCloseCommPort = False
    2590                      gmoduleOK = False
    2600                      ReStartCommunications
    2610                  End If
    2620                  On Error Resume Next
    2630                  hs.RunEx "ADIOcelot_CMAXSync.txt", "AfterCMAX", ""
    2640                  Err.Clear
    2650              End With
    2660          End If
    2670      End If