Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting errors from ExecApp?
#1
I am working on a triggered event which uses ExecApp. The first execution is fairly straight-forward and works fine. The second one is a bit of a parsing nightmare, and I'm trying to figure out why it's not working.

To test, I took the results of the parameter string I built and wrote them to a Variables driver field. Then I copied that text and pasted it in a Command Prompt on the master server. That worked fine.

However, when I run it from the trigger I get no results, and I don't know how to figure out why. Here are the commands I'm running:

Code:
// Add the latest value to the database
System::ExecApp
    P1=C:\\rrdtool\\rrdtool.exe
    P2=update OutdoorTemperature.rrd N:$(OmniProII.Outdoor_temp_CurVal)
    P3=C:\\rrdtool
    P4=Hidden

//
// Now generate an updated graph
LocalVars::SetVariable
    P1=LVar:GraphParameters
    P2=graph OutdoorTemperatureRecent.png --start now-12m --end now

LocalVars::Append
    P1=LVar:GraphParameters
    P2= --vertical-label \"Degrees F\" --title \"Office Temperature Last 12 Minutes\"

LocalVars::Append
    P1=LVar:GraphParameters
    P2= DEF:cTemp=OutdoorTemperature.rrd:temp:AVERAGE

LocalVars::Append
    P1=LVar:GraphParameters
    P2= VDEF:tempMAX=cTemp,MAXIMUM VDEF:tempMIN=cTemp,MINIMUM VDEF:tempLAST=cTemp,LAST

LocalVars::Append
    P1=LVar:GraphParameters
    P2= LINE3:cTemp#00FF00

LocalVars::Append
    P1=LVar:GraphParameters
    P2= GPRINT:tempMAX:\"        max\\: %2.1lf\"

LocalVars::Append
    P1=LVar:GraphParameters
    P2= GPRINT:tempMIN:\"        min\\: %2.1lf\"

LocalVars::Append
    P1=LVar:GraphParameters
    P2= GPRINT:tempLAST:\"        cur\\: %2.1lf\\l\"

Devices::FieldWrite
    P1=Variables.TestString
    P2=%(LVar:GraphParameters)
    P3=True

System::ExecApp
    P1=C:\\rrdtool\\rrdtool.exe
    P2=%(LVar:GraphParameters)
    P3=C:\\rrdtool
    P4=Show
And this is the resulting string that works in the Command Prompt:
Code:
graph OutdoorTemperatureRecent.png --start now-12m --end now  --vertical-label "Degrees F" --title "Office Temperature Last 12 Minutes" DEF:cTemp=OutdoorTemperature.rrd:temp:AVERAGE VDEF:tempMAX=cTemp,MAXIMUM VDEF:tempMIN=cTemp,MINIMUM VDEF:tempLAST=cTemp,LAST  LINE3:cTemp#00FF00  GPRINT:tempMAX:"        max\: %2.1lf" GPRINT:tempMIN:"        min\: %2.1lf" GPRINT:tempLAST:"        cur\: %2.1lf\l"
I had this working in Housebot using a VBscript to generate the commands, and executing them by calling the Run method of the WScript.Shell object.

Any ideas? Is there a way to get any output that was generated when the app was executed? Also, I also tried it with the "^1" parameter but that made no difference.

I just noticed something. I'm getting this in the log:

The application is running but could not be activated.

What does that mean?
Reply
#2
I'm invoking the same application twice in a row (but with different parameters) in the same triggered event. Is that a problem? Is the execution synchronous or asynchronous?
Reply
#3
I'm no longer getting the error in the log, but it's still not executing the second action.
Reply
#4
From an event the invocation would be asynchronous, since it has no idea how long the program might run. But it does track running programs. If it's still running when you invoke it again, it will try to just bring it forward (the same code is used in the Tray Monitor to run GUI apps, where that makes more sense.)

So the second invocation was trying to 'bring forward' an app that could be brought forward because it's not running in the GUI context.

You will probably need some means to insure the first one has completed before invoking it again. Not sure how that would work though. I guess you could always write a simple program that just invoked the other two from within itself. You could first just make it a dummy program and use it to debug what it thinks the incoming parameters are, by dumping them to a file.

Or, of course you could simplify and pass in the raw info via much simpler parameters and let the program format them out in the form required to invoke the graphing program.
Dean Roddey
Explorans limites defectum
Reply
#5
Ok - thanks Dean. I'm trying hard to do everything the "CQC way" as much as possible, if for no other reason than to become very familiar with what is possible.

In this case though I'll probably just fall back to using the scripts I already have, or write a small program.
Reply
#6
I'm sure it's doable, but it can get hairy when the command line is really complicated and has lots of quotes and such.

One thing to try perhaps is to use single quotes within the command line, so that quotes added by CQC won't confuse things.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Recurring Errors - Help to identify Bugman 1 299 04-02-2022, 07:52 AM
Last Post: Bugman
  More CQC Errors znelbok 3 485 01-23-2022, 06:32 AM
Last Post: Dean Roddey
  New Install Errors znelbok 3 566 11-29-2021, 02:42 AM
Last Post: znelbok
  ExecApp Action Failing Shaky 2 466 11-02-2021, 08:17 PM
Last Post: Shaky
  I cant enter parameters for sizing into the webcam widget. I get errors about invalid ghurty 2 1,243 04-29-2020, 04:01 PM
Last Post: Dean Roddey
  RIVA errors zra 3 1,529 02-09-2020, 04:02 PM
Last Post: Dean Roddey
  unclear errors (and tons) IVB 7 2,987 01-21-2018, 09:57 AM
Last Post: Dean Roddey
  ExecApp and .bat simon 15 6,689 11-16-2017, 06:27 PM
Last Post: Dean Roddey
  ExecApp to Start/Stop Windows Service? jaydonoghue 6 4,598 01-04-2017, 06:46 PM
Last Post: Dean Roddey
  Locating Errors via Log File zra 1 1,834 11-28-2015, 02:50 PM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)