Please click the above image for a larger, and scarier, version ;)
Hello again,
Just in case you read the title and thought "oh man, more color?", I've kept it to a minimum here ;) Although the concepts used in creating today's script were covered in our previous posts on using color in the shell and creating a simple color menu (both for Linux and Unix), this one is just different enough that I thought it might be of interest to some folks out there.
Today's script is actually for a very specific brand of Linux: Cygwin for Windows XP (I think you could get away with using this script letter-for-letter on Windows 2000, but I can't be sure about ME and Vista).
The script interface is designed so that you can access the Windows Control Panel directly from your default Cygwin Bash shell. Check out the picture above for a look at it in action (breathtaking... ;). Unfortunately, I have yet to figure out how to make Cygwin control the Control Panel applets once they've launched in Windows. I believe it might be possible with some Tk button pushing, but that's beyond where I'm at with Cygwin.
The script can be run simply from the command line and requires no arguments (Although it does assume that your Windows environment is setup correctly and your system knows where its system32 folder is):
user@hostpc ~ ./xpcpanel.sh
You'll note that not every single control panel option is included in our Linux menu shell script. I picked the top 16 (This is a subjective rating system of course ;). All of the other applets should be listed under your main Windows directory, in the system32 folder and named something like "applet.cpl". For instance, the output from an "ls" on my machine comes out to around 30 applets. They can all be run using the "control" command, like so:
user@hostpc ~ control main.cpl
And here's the complete list of applets you can use to customize this menu (The number and availability may vary depending on your system, but this should be a fair representation. Also note that /cygdrive/c/WINDOWS/system32 directory is actually C:\WINDOWS\system32 if you use Windows to navigate):
user@hostpc ~
$ ls /cygdrive/c/WINDOWS/system32/*.cpl
/cygdrive/c/WINDOWS/system32/access.cpl
/cygdrive/c/WINDOWS/system32/appwiz.cpl
/cygdrive/c/WINDOWS/system32/bthprops.cpl
/cygdrive/c/WINDOWS/system32/desk.cpl
/cygdrive/c/WINDOWS/system32/firewall.cpl
/cygdrive/c/WINDOWS/system32/hdwwiz.cpl
/cygdrive/c/WINDOWS/system32/inetcpl.cpl
/cygdrive/c/WINDOWS/system32/infocardcpl.cpl
/cygdrive/c/WINDOWS/system32/intl.cpl
/cygdrive/c/WINDOWS/system32/irprops.cpl
/cygdrive/c/WINDOWS/system32/javacpl.cpl
/cygdrive/c/WINDOWS/system32/joy.cpl
/cygdrive/c/WINDOWS/system32/main.cpl
/cygdrive/c/WINDOWS/system32/mlcfg32.cpl
/cygdrive/c/WINDOWS/system32/mmsys.cpl
/cygdrive/c/WINDOWS/system32/nCredps.cpl
/cygdrive/c/WINDOWS/system32/ncpa.cpl
/cygdrive/c/WINDOWS/system32/netsetup.cpl
/cygdrive/c/WINDOWS/system32/nusrmgr.cpl
/cygdrive/c/WINDOWS/system32/nwc.cpl
/cygdrive/c/WINDOWS/system32/odbccp32.cpl
/cygdrive/c/WINDOWS/system32/powercfg.cpl
/cygdrive/c/WINDOWS/system32/sapcacpl.cpl
/cygdrive/c/WINDOWS/system32/sapfcpl.cpl
/cygdrive/c/WINDOWS/system32/sysdm.cpl
/cygdrive/c/WINDOWS/system32/telephon.cpl
/cygdrive/c/WINDOWS/system32/timedate.cpl
/cygdrive/c/WINDOWS/system32/wgpocpl.cpl
/cygdrive/c/WINDOWS/system32/wscui.cpl
/cygdrive/c/WINDOWS/system32/wuaucpl.cpl
And here it is. I hope you enjoy it and find it useful. Once I'm on the Linux command line, I don't want to futz around with Windows unless I have to, and this script helps out a little :)
And, oh yes, note also that this is a fairly long menu (16 control panel items alone), so the default Cygwin window won't be big enough to fit it all in. As long as you enter a value (it can even be bogus) and hit any key, it will redraw the screen so you can resize your window as many times as you want)
Cheers,
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License#!/bin/bash
#
# xpcpanel.sh - Save Yourself The Hassle Of Dealing With The XP Start Menu :)
#
# 2008 - Mike Golvach - eggi@comcast.net
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#
trap 'tput reset;exit 1' 1 2 3 9 15
tput civis
while :
do
echo -e "\033[44;37;22m"
clear
echo -e "\033[41;37m"
echo -ne "\033[46;30m"
tput cup 8 25 ; echo -n " Windows XP Control Panel "
tput cup 9 25 ; echo -n "----------------------------"
tput cup 10 25 ; echo -n " Choose Your Option "
echo -e "\033[40;32m"
tput cup 12 25 ; echo -n " 1. Accessibility "
tput cup 13 25 ; echo -n " 2. Add/Remove Programs "
tput cup 14 25 ; echo -n " 3. Display Settings "
tput cup 15 25 ; echo -n " 4. Add Hardware "
tput cup 16 25 ; echo -n " 5. Internet Explorer Setup "
tput cup 17 25 ; echo -n " 6. Regional Settings "
tput cup 18 25 ; echo -n " 7. Game Controllers "
tput cup 19 25 ; echo -n " 8. Mouse Settings "
tput cup 20 25 ; echo -n " 9. Keyboard Settings "
tput cup 21 25 ; echo -n " 10. Sound/Audio Settings "
tput cup 22 25 ; echo -n " 11. Network Settings "
tput cup 23 25 ; echo -n " 12. User Account Settings "
tput cup 24 25 ; echo -n " 13. Power Settings "
tput cup 25 25 ; echo -n " 14. System Properties "
tput cup 26 25 ; echo -n " 15. Phone And Modem Options"
tput cup 27 25 ; echo -n " 16. Date/Time Settings "
tput cup 28 25 ; echo -n " 17. Quit "
echo -ne "\033[41;30m"
tput cup 30 28 ; echo -n " Pick Your Poison: "
tput cup 30 48
tput sc
read y
tput cup 32 30
case "$y" in
1)
control access.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
2)
control appwiz.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
3)
control desk.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
4)
control hdwwiz.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
5)
control inetcpl.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
6)
control intl.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
7)
control joy.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
8)
control main.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
9)
control main.cpl,@1
tput rc
echo -n "Any Key To Menu"
read x
;;
10)
control mmsys.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
11)
control ncpa.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
12)
control nusrmgr.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
13)
control powercfg.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
14)
control sysdm.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
15)
control telephon.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
16)
control timedate.cpl
tput rc
echo -n "Any Key To Menu"
read x
;;
17|q|Q)
tput sgr0
clear
exit
;;
[A-Za-z])
tput cup 32 28
echo "Unless you're quitting, please Pick a NUMBER"
tput rc
echo -n "Any Key To Menu"
read x
;;
*)
tput cup 32 28
echo "$y - Unknown Option"
tput rc
echo -n "Any Key To Menu"
read x
;;
esac
done
, Mike
linux unix internet technology