I have written a script in python that I intend to help create simple loggernet device entries.
But I have hit a wall, is there any way of feeding commands to cora_cmd.exe with out directly inputting the command into the interpreter.
Such as (from windows command) "C:\Program Files(x86)\Campbellsci\LoggerNet\cora_cmd.exe" -connect localhost;
Or perhaps pass it a file with the commands written inside.
You might look at pexpect, "a pure Python module that makes Python a better tool for controlling and automating other programs. Pexpect is similar to the Don Libes `Expect` ...".
I haven't used it, but have used Expect in other forms. Typically, you tell Expect what program to wrap or control, then send commands and wait for responses, which can be handled in various ways.
Cora will execute commands piped to it on standard input, for example, you can:
echo connect localhost;lists-stations;exit; | cora_cmd.exe
although, cmd.exe's echo is very limited - but you could likely have your python script execute cora_cmd.exe as a sub process and pass it input via a filehandle to the subprocess's stdin:
http://stackoverflow.com/questions/163542/python-how-do-i-pass-a-string-into-subprocess-popen-using-the-stdin-argument
Thanks guys.
mjb that is the exact answer I was looking for. Cheers.