Side Project: Command Prompt Alternative

Side Project: Command Prompt Alternative
So today yesterday was my first day back at school. Everything was totally normal, and uninteresting until I got to my first programming class when I immediately noticed something was off… after logging into one of the computers we use for coding projects, I opened the Start menu (yes, these computers are running Windows XP. It sucks, I know.),  and I realized that they removed the “Run” command, which I used all the time, as I’m so used to using the terminal to launch programs in Ubuntu Linux. It’s not that I can’t use a GUI, but it’s so much faster to simply type a command than to navigate through the Applications menu and find what you’re looking for. Especially in the case of certain programs that are console only. Upon further searching through the Start menu, I noticed that NetBeans, an excellent IDE for editing code was missing, which makes no sense, considering the fact that we are in a computer programming class. They do, however, teach us to code Java using Notepad, the worst text editor ever for coding, and command prompt. Honestly that wouldn’t be so bad if Notepad had syntax highlighting, and a half decent (more than 3 edits) undo history. I mean, I edit source code using gedit all the time, and it works great! Regardless of the language, it seems to always know when I want syntax highlighting on or not, mostly by the file extension, and the undo history is superb! Unfortunately this is not the case at all with Notepad. So, guessing that they only removed the “Run” command from the Start menu, I tried opening the shortcut to command prompt from the Accessories folder, which resulted in a rather irritating message saying that the Administrator disabled access to command prompt. Not only do we need command prompt in order to code the way they want us to, command prompt is a very useful tool for power users that allows you to get work done at a much faster rate, as you don’t have to spend as much time searching through cluttered menus and looking for shortcuts. Perhaps this is why I’m so productive when I’m on a Linux machine in the GNOME Desktop Environment… everything feels organized and natural. Even the “Applications Menu” is automatically sorted by category, and there aren’t tons of cluttered folders lined with useless shortcuts like “Uninstall” links. Not that you need uninstall links in Ubuntu, thanks to the wonderful Synaptic package management system. Anyways, since our teacher realized that it was nigh impossible to learn anything, or even get started writing basic programs without a way to compile and test them, we were allowed to play around and do what we want during that time. I decided I’d play with the Python coding language (which they don’t even offer to teach at our school, yet there is a Python IDE installed — imagine that!). In particular, I decided to mess with the ‘subprocess’ packages in Python. After around 15 minutes, I managed to have a shell-based UI that let you enter a command, and returned output when the command finished running. After that, I mostly spend the rest of the time optimizing my code and handling exceptions. Once I got home, I fired up Python, and, as I didn’t have access to any of the code I wrote before, I started the whole thing from scratch, which took much less time, as I already knew what I was doing, and I’m pretty sure my code ended up working better than before, but it was still in a shell, which was unsightly to say the least. So, I did some research into Python-based graphical user interfaces, and I discovered a wonderful little library called “Tkinter”. Not only that, but I also discovered that even though our school has Python 2.5 installed in Windows, which is fairly dated (but not as old as the copy of Visual Studio we have installed — version 6 — which is from 1998), it comes with the Tkinter packages pre-installed. So, I spent a few hours coding, and it finally got to the point where, in terms of GUI, I was very satisfied with what I had, especially considering the fact that I had very little knowledge of Python when I first started coding this, and I knew nothing about Tkinter before today. Once I had the GUI done, porting the logic part of the code was incredibly easy, as I only had to add a few hooks and API calls to the script in order to add event listeners to the GUI and manipulate elements like the scrollbars when the console changes. After several hours of coding, I now have a pretty solid application that just needs a bit more work. Of course, I still have to work on doing other things than running commands like changing the working directory and setting environmental variables (both of which are practically necessary in order to compile and run Java applications), but I’m rather impressed with how versatile and easy to use Tkinter is. I haven’t actually tested this on Windows XP, being an Ubuntu user and all, but I plan on doing so tomorrow. Keep in mind this is an early prototype, and it will probably change a bit over time. This is just a side project, and it shouldn’t get in the way of me developing my other applications, like Clippy, but I will have less time to develop as I’ll be under pressure from my tedious school schedule. But for now, just enjoy the screenshot! 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: