Hi all,
I have a question: is it possible to transfer a file from a Loggernet server (located, for instance, on the C:\ drive) to the CPU or USR drive of the CR1000, using CRBasic commands?
I've seen that the GetFile method accepts 4094 as source address for the file, but the instruction does not work, i.e. it creates an empty file in the Destination, but it seems not to be able to read the source file (in fact the ResultCode variable get positive increments each time it tries but fails).
Any clues?
Two ways to send a file using LoggerNet would be to use Corascript's send-file command, or if connected to the datalogger via IP, send the file via FTP using a third party FTP client. Both of these methods can be set up in LoggerNet's Task Master to have the event triggered on a schedule, or you could set up a dashboard using RTMC Pro to execute the event if you wanted to trigger it manually.
Corascript is a scripting utility that comes with LoggerNet. There's a help file that is included, where you can read more about send-file.
Dana
Thank you Dana, I chose the Corascript method and it worked flawlessly.
Hello, I've successfully used the ModemCallback instruction to call a Loggernet server, plus Corascript to send a file to my CR1000 station from a loggernet pc.
I've read, in ModemCallback manual, that:
"Note that once executed, this instruction runs in the background. The datalogger will not wait for successful communication before moving on to the next instruction."
Now, I need to be sure that the file I'm receiving from Loggernet is completely written before accessing it in my crbasic code. Is there a way to "sync" the modemcallback, in order to know when it finished its execution? Maybe something dealing with SlowSequence?
You might be able to determine if the file has been written using FileList. FileList does not list files that are still opened for writing. If you knew the file name you were expecting, you could FileList, do some sort of StringComp, and then access the file based on the results of that comparison.
Note that FileList does not clear the array that has been written to, so you would want to clear it out before "listing". (This fact is currently not in the help file, but will be soon). Also, you might need to delete the existing file prior to receiving the new one.
I hope this sparks some ideas...
Dana
Dana mentioned FileList().
You may also find helpful
+ NewFile() - lets you know if file is new
+ FileTime() - develop your own alternative to NewFile()
+ FileSize() - see if size of file has changed by X bytes
FileList seems to work, but requires a lot of instructions to see if a new version of the file has been created. I think I will give NewFile() a try, as suggested by Sam