LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-18-2005, 06:22 AM   #1
juanbobo
Member
 
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365

Rep: Reputation: 30
How to pass data to a console program with multiple inputs?


The title may be a little unclear, but what I want to do is send data to a program that prompts the user several times. I was thinking to send a newline character at the end of each field, but that doesn't seem to work. How is this possible?
 
Old 08-18-2005, 05:54 PM   #2
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Re: How to pass data to a console program with multiple inputs?

Quote:
Originally posted by juanbobo
The title may be a little unclear, but what I want to do is send data to a program that prompts the user several times. I was thinking to send a newline character at the end of each field, but that doesn't seem to work. How is this possible?
It depends on how the program is trying to retrieve the input. If it is just reading from stdin, your method out to work-- however, if it is a program like passwd that forces a read from the console, you might need something like an "expect" script.
 
Old 08-18-2005, 06:29 PM   #3
juanbobo
Member
 
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365

Original Poster
Rep: Reputation: 30
Thanks a lot Carl, you answered my question. Also, how is it possible to automate inputting data into GUI fields?
 
Old 08-18-2005, 06:39 PM   #4
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Quote:
Originally posted by juanbobo
Thanks a lot Carl, you answered my question. Also, how is it possible to automate inputting data into GUI fields?
That is harder to do in some cases. It depends on the toolkit being used. With TK, I believe there is a "send" command you can use to automate applications. With KDE, you can use DCOP ("kdcop" is a good tool for exploring the interfaces). For other GUIs, your milage may vary. I do not know of a universal way to manipulate them.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass data from one apllication to another. Darkeye Linux - Software 6 10-17-2005 01:10 AM
pass message from console to UI? okeyla Linux - Newbie 1 09-19-2005 06:49 PM
Pass data between windows agallant Programming 3 10-21-2004 11:29 AM
Simple IPTables... Want to pass all data from one external IP to an internal IP AdamRankin Linux - Networking 3 04-01-2003 03:24 AM
mandrake 9 console and mouse inputs lowly_tech Linux - Hardware 1 02-24-2003 09:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration