Automating KDE (or Gnome) data entry with a shell script

I have recently brought up openSuSE 13.1 on an AMD 64 platform.

My objective is to write a shell script (or equivalent) that takes the place of many mouse clicks and text entry in KDE windows. For example, I would like to have two scripts that set IP, gateway and DNS addresses. One script would set this computer up for internal network use, another for full web access.

The last time I did something like this, it involved copying versions of /etc/reslov.conf and /etc/hosts, and restarting httpd. I have learned by trial and error that this doesn’t work in 13.1. I have triggered kernal panics with various attempts at this. Is there a tool for automating manual data entry into KDE windows?

Searches on “scripts” seems to bring up C++ advice, while “automation” doesn’t seem helpful either. In the Windows world, there are “macro recording” tools that let me walk through what I want to do with mouse clicks and text entry, and then replay it with a button click. Is there anything comparable in the Linux world? Thanks!

Bleh… thank-you for posting your “business case” (automatically setting
IP, gateway, DNS nameserver entries, etc.) along with your technical
desire (GUI-manipulation via shell scripts) as the latter is insane and
the former is pretty easy to do.

First, if building new systems, there is a technology in SUSE called
AutoYast that lest you specify, at install time, what the various settings
should be. Network settings are among the many other possibilities that
can be specified. Besides doing this on a computer-by-computer basis, you
can set this up to be able to image entire networks by having config files
that match systems by MAC address, if you are so inclined. The end result
is a system setup properly in a way that Yast will respect going forward
and in a way that doesn’t require quirky stuff like shell scripts
manipulating GUI elements like mice and cursors. There’s a place for that
(direct manipulation of GUIs) type of thing, but if you were to do that
for this you’d be working way, way too hard.

If you do not want to use AutoYast then the next way to make this happen
is still to modify text files directly, but not the /etc/hosts,
/etc/resolv.conf, etc. Instead you should modify the files that Yast
itself uses for storing network data and those are within
/etc/sysconfig/network and while you’ll need to poke at things a little to
make it all perfect the end result is that the manipulations are pretty
easy to do and will be set properly for any SUSE-based system.

Both of these options are available for both openSUSE as well as the SUSE
Linux Enterprise line of products, and you’ll probably find the latter
approach even portable to other distributions.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

docduke wrote:
>
> I have recently brought up openSuSE 13.1 on an AMD 64 platform.
>
> My objective is to write a shell script (or equivalent) that takes the
> place of many mouse clicks and text entry in KDE windows. For example,
> I would like to have two scripts that set IP, gateway and DNS addresses.
> One script would set this computer up for internal network use, another
> for full web access.
>
> The last time I did something like this, it involved copying versions of
> /etc/reslov.conf and /etc/hosts, and restarting httpd. I have learned
> by trial and error that this doesn’t work in 13.1. I have triggered
> kernal panics with various attempts at this. Is there a tool for
> automating manual data entry into KDE windows?
>
> Searches on “scripts” seems to bring up C++ advice, while “automation”
> doesn’t seem helpful either. In the Windows world, there are “macro
> recording” tools that let me walk through what I want to do with mouse
> clicks and text entry, and then replay it with a button click. Is there
> anything comparable in the Linux world? Thanks!
>
>
Are you looking for something like AutoYaST
http://support.novell.com/techcenter/articles/nc2006_03a.html
http://www.softpanorama.org/Commercial_linuxes/Suse/Yast/autoyast.shtml


GNOME 3.10.1
openSUSE 13.1 (Bottle) (x86_64) 64-bit
Kernel Linux 3.11.6-4-desktop

ab: Thanks very much! This answers almost all of my question. I don’t think the DNS addresses are in there. I’ve found the others. Is there a place in documentation somewhere that leads to the locations of files like this? ‘man yast’ has a Files section at the bottom that doesn’t mention /etc/sysconfig/network.

](http://forums.opensuse.org/members/vazhavandan.html) vazhavandan](http://forums.opensuse.org/members/vazhavandan.html): I used AutoYast previously, but it was grayed out in the DVD install. Maybe I needed to select some option during the install to get it. I do both multiple installs and system alterations on the fly, to enable and disable internet access for security reasons.

Thanks for the help!

Maybe this thread will help, since at least it has examples for nameserver
specifications:

https://forums.suse.com/archive/index.php/t-2838.html

If not, Autoyast can be setup from within Yast. You may need to install
the ‘autoyast2’ package which, after restarting Yast (if open), will
create an option in Yast to build control files for AutoYast use. Give
that a shot and I’m fairly sure your options will be present in there
since missing DNS settings would be a pretty huge oversight, imo.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

You may have taught someone “how to fish.” But I didn’t expect my fishing rod to have quite so many bells and whistles! :wink: I installed autoyast, but it came in with Adobe Acrobat, an MP3 player and more than 100 MB of wallpaper and icon graphics. Anyway, I told it to clone just my network settings, and got a 2301-byte XML file, which probably sets the record for the shortest XML file I have seen!

Thanks very much for the suggestions! I’m going to back up my system before I turn autoyast loose on it, but it looks like you have given me a solution to my “business case” as well as a very large number of other potential generalizations of that case.