Help with ip output stream from Basic macro in OOo Calc on XP

View: New views
2 Messages — Rating Filter:   Alert me  

Help with ip output stream from Basic macro in OOo Calc on XP

by Martin Jacobs-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Please forgive me writing to you on this e-mail address, but I find the
OOo world overwhelming from my limited knowledge of computing theory and
terminology, and I haven't found how or where to submit a request for
help.  I am looking for a snippet as described below.  Is this the sort
of thing that some kind person might write for me? If not, can you
please suggest where I might put my request?  I would be grateful for
any assistance.

I am happy to explain why I want it, but it's a long story -
essentially, it's for writing to an LED display hung over a theatrical
stage, using a WiFi connection from a laptop. If it works reliably, I
intend to make the code freely available, as this sort of requirement is
becoming increasingly in demand to help the hard-of-hearing and for
language barriers.  Current commercial software is either very expensive
or too crude. However, I need to implement the connection before I worry
about how to publish the code!  Anyway, here is the request.




Help with ip output stream from Basic macro in OOo Calc on XP.


I am attempting to send lines of text to a remote display device.  As a
first step, I have written a set of macros to extract the data I want
from a spreadsheet and save each line as a file on disc in the required
format.  I did this by copying bits of code I found, with a very
superficial understanding of how it all works.  I am very grateful to
all those who contribute examples and help.

My next step is to send the data to the display device instead of disc
file.  The instruction I have from the device manufacturer is -

"Use a socket component and transmit the data string to port 10001 on
the IP address of the display device."

I have no idea how to do this, and have not found examples that I
understand.  The display only listens and does not respond - does that
mean I should use UDP rather than TCP?   Below is my current output
routine.  I would be grateful for suggestions on how to convert or
replace it.


Sub DisplayText(FilePath as String, DataString as String)
rem            Currently writes a file to disc - overwriting the
previous.
rem            derived from Useful Macro Information. For
OpenOffice.org.
rem            by Andrew Pitonyak. www.pitonyak.org/oo.php and
CodeSnippets
Dim oFileAccess as Object
Dim oFile as Object
Dim oOutputStream as Object
        oFileAccess =
createUnoService("com.sun.star.ucb.SimpleFileAccess")
        oOutputStream =
createUnoService("com.sun.star.io.TextOutputStream")
        If oFileAccess.Exists(FilePath) Then
                oFileAccess.Kill(FilePath)
        Endif
        oFile = oFileAccess.OpenFileReadWrite(FilePath)
        oOutputStream.SetOutputStream(oFile.GetOutputStream)
        oOutputStream.WriteString(DataString)
        oOutputStream.CloseOutput()
End Sub




Thank you

Martin
Martin Jacobs

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Help with ip output stream from Basic macro in OOo Calc on XP

by Jan Holst Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Jacobs wrote:

> I am happy to explain why I want it, but it's a long story -
> essentially, it's for writing to an LED display hung over a theatrical
> stage, using a WiFi connection from a laptop. If it works reliably, I
> intend to make the code freely available, as this sort of requirement is
> becoming increasingly in demand to help the hard-of-hearing and for
> language barriers.  Current commercial software is either very expensive
> or too crude. However, I need to implement the connection before I worry
> about how to publish the code!  Anyway, here is the request.
>
>  

Sounds fun!

> Help with ip output stream from Basic macro in OOo Calc on XP.
>
> I am attempting to send lines of text to a remote display device.  As a
> first step, I have written a set of macros to extract the data I want
> from a spreadsheet and save each line as a file on disc in the required
> format.  I did this by copying bits of code I found, with a very
> superficial understanding of how it all works.  I am very grateful to
> all those who contribute examples and help.
>
> My next step is to send the data to the display device instead of disc
> file.  The instruction I have from the device manufacturer is -
>
> "Use a socket component and transmit the data string to port 10001 on
> the IP address of the display device."
>
> I have no idea how to do this, and have not found examples that I
> understand.  The display only listens and does not respond - does that
> mean I should use UDP rather than TCP?   Below is my current output
> routine.  I would be grateful for suggestions on how to convert or
> replace it.
>  

I have no idea whether socket communications can be done in OOoBasic.
But I would know how to create a small Windows application that can read
a string from a file and send it to a port on a given IP address. You
can then use SHELL() from OOoBasic to run that application when you need
to update the display. This should be fast enough since you are using it
for something equivalent to subtitles on TV.

But first you should get communications going with the LED display. Try
doing "telnet 10.10.10.1 10001" where 10.10.10.1 is the IP address of
the display. I then believe you should be able to see the text you write
on the LED display. If that works for you I can help you with a
dedicated application for sending strings. Feel free to write to me in
private at the address "jan <at> jan-holst.dk".

Cheers
-- Jan Holst Jensen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...