Hello guys,
a customer asked me, whether it is possible to catch the output of a started (via SCADA Basic or VBA) cmd-program using also SCADA Basic or VBA.
Of course I told him the option to write in a text-file and read it (and check whether the output is complete and application is not running any more). He also tries to find a solution like that.
But the question is more, whether it is possible to get the output directly into PcVue, by writing to a variable, use system dlls or something like that, maybe via UserMgr.
So does anyone already had this kind of request and (the more interesting), did you find a solution or do have a ready tool?
Thank you in advance.
Hi Johannes,
Sorry but the question is not so clear for me.
What do you mean by 'output of a started cmd-program'?
But anyway, what you can write in a text-file you can write in a text variable...
Nico
Hello Nico,
what I mean is how to get the output that an application generates, running in a cmd-prompt.
e.g. "dir " generates output.
Or Imagine the replication tool, we discussed weeks ago. If running / starting in a cmd-prompt, the tool generates output, in this case the lines, that were replicated.
So my question is, whether it is possible to get this generated (visible in the cmd-prompt) output directly into pcvue, using SCADA Basic or VBA (or UsrMgr).
This is possible e.g. using T-SQL in MS SQL Management Studio to read "dir /b" directly into a MS SQL table and react on the content.
Hope it is little bit more clear. 😉
Ok clear.
So, as I said, what is in a text file could be on a text variable without any problem. Just set the text variable with the file content.
FILETOBUF -> TEXTVAR("BUFTOTEXT"..)
But there is a limit: text variable max size is 32 000 chars. In your case (replication tool logs) it will be probably more...
But what is exactly your purpose?
I guess you want to diplay a report of the replication to the user. So, in this case, your code must analyze the file first. Final result would be:
- No errors -> OK
- If error -> Display errors list
Nico


