You are not logged in.

#1 2011-01-16 22:36:43

falconheart
Member
Registered: 2010-04-24
Posts: 9

"catching" a prompt for user input and answering it through zenity?

I'm trying to write a script (or multiple scripts) that will allow me to use command-line only applications via user defined actions in my file manager without having to open a terminal. Now I realize this basic functionality is already available, but as it stands I am unable to respond to command-line prompts for user input without opening a terminal. Is it possible to write a shell script that would act as a wrapper and allow me to use zenity (or another popup program) to respond to such queries?
For example if I used a command-line program that prompted me for a password, could I "catch" that prompt with a shell script and answer it through another program, such as zenity?

Last edited by falconheart (2011-01-16 22:37:25)

Offline

#2 2011-01-26 16:36:48

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: "catching" a prompt for user input and answering it through zenity?

The easier way to do this is to collect the info with zenity first, then pass it on the command line.  If the program insists on prompting, then you could try feeding it the info with redirection if it accepts it from stdin.  For example

command < info.txt

where info.txt is a temp file created by your script which contains whatever you want entered into the prompts.  This will work in some cases.

Offline

Board footer

Powered by FluxBB