From: Ryan Mohr on
Brian Candler wrote
> Otherwise, perhaps you can explain what you are trying to achieve?

In addition to the CLI, I'm developing a simple gui interface. As the
user interacts with the gui, commands are sent back to the CLI through a
socket connection.

At this point my CLI has nearly 100 commands and growing, so the easiest
approach would be for the GUI to just send the text command desired and
have it "typed" into the main app.

If I go the internal API route (eg. no simulated typing), the command
executes and the output is displayed, but now the old prompt is buried
above the new output and the prior 'gets' request is still waiting for
input. Since some of the commands have nested commands requesting input
of their own, this stale 'gets' call is problematic.

It's all pretty messy and probably hard to understand from my
description. The addition of the gui was an afterthought so the CLI
wasn't designed for this kind of use. The elegance of a simulated
typing solution has pushed me towards using applescript to solve the
issue (but even that has issues of its own such as the inability to send
text to specific background windows).

Thanks for all the help though. I'll keep hacking away at it.
--
Posted via http://www.ruby-forum.com/.

From: brabuhr on
On Wed, Jun 16, 2010 at 6:34 PM, Ryan Mohr <ryan.mohr(a)gmail.com> wrote:
> Brian Candler wrote
>> Otherwise, perhaps you can explain what you are trying to achieve?
>
> In addition to the CLI, I'm developing a simple gui interface.  As the
> user interacts with the gui, commands are sent back to the CLI through a
> socket connection.
>
> At this point my CLI has nearly 100 commands and growing, so the easiest
> approach would be for the GUI to just send the text command desired and
> have it "typed" into the main app.

In the GUI program run the CLI via PTY.spawn and let the GUI program
write ("type") commands (directly) to the CLI (instead of using a
socket). If the GUI and CLI must run on separate hosts, launch the
CLI remotely via, for example, Net::SSH. As a third alternative write
a small helper program to run on the server, it will run the actual
CLI via PTY.spawn and listen on the socket for connections from the
GUI.

From: Jesse Jurman on
I don't exactly understand what your trying to make, but in any
instance, whether it's gui or not, you might have a program turn your
input into a file, and then have your original program check if such a
file exists, read it, and then delete it... I haven't tried something
like it yet, but I plan on using a technique like it in one of my own
programs.
--
Posted via http://www.ruby-forum.com/.

First  |  Prev  | 
Pages: 1 2
Prev: Execute ruby file from a ruby file
Next: unsubscribe