Menu

read data from Windows Clipboard?

2008-06-29
2013-05-28
  • Nobody/Anonymous

    Hello, is it possible to read lines of data from the Windows Clipboard as it is being up updated, instead of a CSV file?

    Thanks,
       Stewart

     
    • Nobody/Anonymous

      I have modified the org.LiveGraph.dataCache.UpdateInvoker and .DataStreamToCacheReader classes to change LiveGraph's data reading behaviour, but I am not sure what exactly you need to do in order to read from the clipboard.
      What kind of an application writes its data to the clipboard anyway?

       
    • Greg Paperin

      Greg Paperin - 2008-07-04

      That is right, those two classes are the ones to look at when you want to add this functionality.
      Cheers..

       
    • Nobody/Anonymous

      Hi, thanks for the reply.  A high school solar car team is getting serial information about their car and analyzing it with livegraph, they were using hyperterminal to capture the info to a file and then using livegraph to analize it, but livegraph is having somme problems when non numeric characters are in there, for example when tranmitting the volts of the battery it says 48.1v. 

      They've asked me to write a little program to strip out the letters so livegraph works better, i'm not much of a programmer and am using visual basic for the little program that reads the serial port and thought just posting the info to the clipboard every second might be easiest.  I'm unsure if livegraph will be able to read a vb opened file or not.  Any thoughts would be appreciated, thanks.

      stewart

       
      • Nobody/Anonymous

        I had a similar problem - I had to apply a function that is not supported by LiveGraph to data from a program. The program was writing data to file A and I was reading it, applying the function and writing it to a file B:
        [program] => [file A] => [my tool] => [file B] => [LiveGraph]

        I was using C++ and closing B after each write. There was no problem with this method, but as I do not know too much about Java nor about VB, I do not know how this approach will work in your case.

         
    • Nobody/Anonymous

      Yeah, i'm trying that too, hopefully it will work well.  Thanks.

       
    • Nobody/Anonymous

      Well, I'm having it close the file after writing, but once livegraph opens the file it is preventing my program from opening it back up again.  I'm using NS Basic, an offshoot of VB, that is probably the cause, but regardless realtime monitoring isn't working.  If there was a way to just grab data from the clipboard it would be easy.

      stewart

       
      • Greg Paperin

        Greg Paperin - 2008-07-09

        As per default LiveGraph cannot read data from the clipboard, it is a justified, but unusual use case.

        The question is, what is the frequency of data updates you are after. If your frequency is not higher that one update per several seconds, just select "Do not cache data" in the data file settings window of LiveGraph. This will cause LiveGraph to close the data file after each update and re-open and re-read it from scratch at the next update. If you also close and re-open the file for each write operation in your Basic program, there should be no problem. If your data file is not large, this will work fine with a relatively high update frequency too - just try it out.

        If your update frequency is very high or your data file very large, this may not be a suitable option. In that case you will need to do some Java programming. As of the recently released version 2.X you can use the "memory stream mode" to pass data without writing it to file. We have successfully tested this even within applets that run with minimal permissions. Unfortunately documentation and examples is still work in progress, but things should be clear if you look at the source code (if you know Java). If you want the clipboard, you can "hack" org.LiveGraph.dataCache.DataStreamToCacheReader (ver 2.X) to read data from the clipboard instead of the input stream if you know Java well enough in order to do that.

        Hope this helps!

         

Log in to post a comment.