Question

Programming is at the heart about automating tasks on a computer.
Presumably those tasks would normally be done manually by a human.
Humans use the computer through the keyboard, mouse, and interaction with the console or the window manager.
But very few languages have built in functions that provide an interface to these basic computing objects.

A notable exception is autohotkey, an open source language on windows, providing builtin functions that allow the following simple tasks:
* Get Pixel Information
* Get mouse position
* Keyboard macros
* Simulate key strokes
* Simulate mouse click
* Window management
See examples on rosettacode.

There have been various attempts on linux, many of which were stopped without explanation. One is the inactive tcl library: android. Search google code for android, lang:tcl

Was it helpful?

Solution

I write web server code. No human being interacts with the code. It's simply a lot of complex plug-ins to Apache.

"Humans use the computer through the keyboard, mouse, and interaction with the console or the window manager. "

This is completely false in my case. The "user" sends requests through HTTP. No keyboard, no mouse, no console, no window manager.

The user may be using some kind of fancy GUI, but it doesn't matter to me or my software. All I see are HTTP GET and POST requests. Pure text.

"But very few languages have built in functions that provide an interface to these basic computing objects."

Correct. I have no use for keyboard, mouse, console or window manager.

OTHER TIPS

All personal computing platforms have libraries that will do this.

The problem is that that would require standardizing user interactions over all systems. Java tried this, without a great deal of success. There have been other libraries with more or less success, Qt probably being the most promising one to date.

It's certainly possible to write a language for a single platform that will include all the UI fundamentals. It's also possible to fake it with a GUI and a library. However, there's good reason to want a language that is usable on any major platform, whether or not there's a GUI.

I doubt the premise is true. Java can do all that, except maybe "window management" since I do not know what is meant by this.

I'd be surprised if you can't do it with c#.

If there are many languages that can't do this, I'd guess it is because it is difficult to do it without tying the language to the operating system.

First of all, I think you're asking why the programming languages' standard libraries don't have built-in interfaces to the window manager. The language itself and its libraries are quite distinct.

One big reason is portability. If there's too many specific functions in a programming language's libraries, it will be harder to port it to other systems. For example, I/O, math functions, strings, various data structures and related algorithms, are all generic and can be made to work on virtually any computer.

But things like the window manager, GUI, etc., they are much more specific to certain platforms which is why they are not included in the standard libraries. This is what makes C/C++ so portable.

Tasks performed by computers without any human interface device interaction outnumber those directly actuated by a human by an enormous factor.

Programming languages tries (or at least is currently trying) to be independent with the platform. Example in .net, you have to reference some Win32 api to do some of the stuffs you specified above. Getting it built-in the core programming language model, .net will become too coupled with the OS, thus, creating its Mono counterpart will be too tedious.

Regarding keystrokes, macros and some stuffs, the simplest way I'm doing it right now is true vbscript or in powershell :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top