How can I make a script to open a program then operate within that program?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I make a script to open a program then operate within that program?
I am very new to linux and am trying out script writing.
I am using shell.
How can I make a script to open a program then operate within that program?
Thanks
Okay just for experimentation purposes I want to make a script to open firefox then perhaps go to a particular website or open VLC media player and play a specific file, stuff like this to open a program then have the program perform a task controlled by the script.....does that make more sense?
At the most basic level, a script is nothing more than a text file containing a series of commands to be run serially. It doesn't matter if the command is cli, gui, or built-in. When one command exits, the script will launch the next one on the list.
At higher levels, there's also a scripting language that allows you to run commands conditionally, or in loops, or in other programmatic ways, and of course there are exceptions and special cases, but underneath it all it's still a one-command-at-a-time process.
If you gave us some details about what you're trying to accomplish, maybe we could help you more directly.
Edit: seeing your reply above, what you probably want is a macro recorder. These are programs that record a series of actions, mouse-clicks, key punches, etc. Then you can play the whole sequence back again.
If you want something more flexible, then it depends on the specific program you want to work with. If the program is controllable through cli, then you can probably script something for it.
Last edited by David the H.; 05-07-2010 at 10:30 PM.
A script that invokes a program might or might not be able to subsequently control that program: it depends entirely upon the program in question.
If "the program in question" supports scripting on its own, however, then it's probably possible for "script #1" to start the program and to instruct that program to "run script #2 upon startup." Once again, it depends entirely upon what "the program in question" has been designed to do, what sort of scripting it supports, and so on.
Many scripting languages that are available in Linux are designed to be usable by programs, which are able to "expose interfaces" to those scripts. For example, Blender (the great open-source 3D-graphics package that I use a lot in my work these days) supports Python. You can write a script within the Blender environment, and say use Blender within that script, and "off you go."
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.