On Sunday 13 February 2005 12:22 pm, Mark Knecht <[EMAIL PROTECTED]> wrote: > Hi, > This is not a Gentoo thing at all but I don't know where else to > ask so I'm coming here. Delete if you're not interested. > > I have a suspicion this is some big scripting job. Scripting to any > great extent is something I know nothing about. I'm hoping that maybe > someone can point me in the right direction. Thanks in advance. > > Within Gnome is there a way that I could double click on a file in > their browser and then cause the system to start executing a program > that asks me questions about what to do? I have some files that are > used in a specialized audio program. Each individual file contain > multiple instruments. I'd like the script to:
You'll have to check some gnome-dev documentation, but generally file system browsers execute external program by running a simple command line. There may be variable in the command-line. Perhaps %f for the name of the file of somesuch. > 1) Check the file for available instruments. I know how to do this > (sort of) at the command line using something like "gigdump > filename.gig | grep Instrument". That almost works well enough for > this task but it does produce one extra line I'll need to get rid of. If you can get it to execute a bash script, the command-line aruments are avilable through $<number> variables. $0 is how the script was invoked on the command line; $1 is the first command-line argument, etc. > 2) Pop up a window and tell me about the instrument list While bash has no support for this, you may be able to use GTK binding for some scipting language Perl/Python to do this. Your first stop for this step is the GTK documentation/tutorial. > 3) Ask me which on I want to use > > 4) Ask me a couple more questions that I answer Reapeat steps 2-3; If you want to show a GUI and you are already running gnome, you'll want to learn/use GTK. > 5) Take the set of answers and send it over the network using some > command like > > echo "command 1" | nc localhost 8888 > echo "command 2" | nc localhost 8888 Most languages will allow you to execute commands like this with some call. This is all bash does; perl has backticks and a few system calls; python and C also have system calls. You may not even need to have the shell do the piping, as you generally get/provide some handle to/for the stdin/out/err of a subprocess. > I know nothing of doing stuff like this but it would be very > helpful. The windows program that uses these files of course has a > fancy file browser that allows you to do this with a couple of click & > drag operations. The Linux program has nothing so I'm doing this by > hand and it's very tedious. Well, do get this done you are going to have to learn a bit. Since you need some degree of GUI interaction, you'll probably want to go with perl or python for the actual script. If you have pervious experience with shell scripting or perl, go that way. If not, go the python way, then you'll know the language portage is written in and can do some serious gentoo hacking. ;) -- Boyd Stephen Smith Jr. [EMAIL PROTECTED] ICQ: 514984 YM/AIM: DaTwinkDaddy -- [email protected] mailing list
