05-28-2015 08:38 AM
Hi,
I am using Labview to update files on the local drives of several computers which are linked by dropbox. When several users try to update these files at the same time it leads to creation of conlicted copies . It would be great if I could check from whithin labview if dropbox is synced, and not trying to update files whilethe vi tries o write new ones. Any ideas?
Thanks!
05-28-2015 05:09 PM
I'll have to leave a bit of the work to you since I am not really going to upload my WindowsAPI library at this moment, but here is how I monitor my DropBox status from LV:
The basic idea is that I tap into the named pipe which is used by DropBox in order to send a status request.
The three subVIs on the left are simple calls into 3 windows functions in Kernel32.dll: GetCurrentThreadId(),GetCurrentProcessId(), and ProcessIdToSessionId(). The Session Id is used to open a connection to the named pipe 'DropboxPipe_SessionID'. The request is packaged with some number I found in the API, the process id, the thread id, and the request type which is 1. The path is converted to UTF-16LE by blowing it up into U16 and byte swapping. If you have funky characters in your file path then substittute a WindowsAPI function to do some real conversions (I find them to be a bit slow and obtuse so I usually skip them). The request is padded to 540 bytes and written to the named pipe. The reply from the pipe contains a status code in a C-string at index=4:
Code 0 = Not in Dropbox, Code 1 = Up to Date, and Code 2 = Syncing
Grab the OpenG pipes library and you should have all of the VIs you need to handle Named Pipes. Just remember you are connecting to an existing pipe and not creating a new one.
Or you could move to Linux and use the very nice command line tool...
05-28-2015 07:54 PM
Amazing. Every time I think I've seen all there is to see from Darin, he pulls another rabbit out of his hat.
06-01-2015 02:38 AM
Thanks!
I learned a lot from this, but unfortunately i don't have the time to delve deeper into the homework you asigned to me 🙂
06-01-2015 03:53 AM
Then I have to wonder what makes you think that someone else, volunteering on these forums, will do your work for you? Darin has given you an exceedingly useful piece of advanced LabVIEW knowledge to allow you to do what you need. You asked for ideas and he's given you almost a complete solution!
/rant
06-17-2015 03:45 AM
absolutely nothing at all, I was just saying thanks and confessing my ignorance and lack of time.