I noticed this question on SO: https://stackoverflow.com/questions/20360181/how-can-you-programmatically-simulate-a-keypress-mousemove (removed for moderation, available to 10k users).

The question was received with 10 downvotes, 5 closevotes, lots of non-constructive comments by 7 (mostly high-rep) users, and one fun answer.

Out of all these people that interacted with the post, none of them even provided a hint towards the solution (not a keyword, not a link, nothing).

Is this the kind of behavior we want on Stack Overflow? Is anybody searching for the question in the future going to gain anything from us responding this way to questions?

For the record, I edited the question and voted to reopen it, since in my opinion, what is asked is on-topic for SO.

  • I see plenty of constructive comments, before someone made a robot arm joke. The user is essentially asking a give-me-the-codez question (specifying two different languages no less). Dec 7, 2013 at 11:08
  • 3
    This is not a good question for Stack Overflow. It is essentially a "translate this code for me" question, showing no research into the facilities of the languages he wants these to be translated to (and which, if done, wouldn't require the question).
    – Oded
    Dec 7, 2013 at 11:09
  • We ask question askers to show effort; this question shows none. Dec 7, 2013 at 11:09
  • @MartijnPieters The first comments were asking for clarifications. Regarding the effort, I agree it does not show any, but still this information could be useful if the question is properly answered.
    – user000001
    Dec 7, 2013 at 11:11
  • 3
    Asking for effort is fine, but making fun of the user (or his issue) just seems rude.
    – 3ventic
    Dec 7, 2013 at 11:11
  • @Oded He is not asking for code translation, rather looking for a solution in more than one languages.
    – user000001
    Dec 7, 2013 at 11:13
  • 2
    Exactly - what he needs is a tutorial - this is not what Stack Overflow is for.
    – Oded
    Dec 7, 2013 at 11:14
  • 1
    Thought a new title might jazz this post up a bit :)
    – user216620
    Dec 7, 2013 at 11:34
  • 2
    I don't see the problem with the question. For windows you can use the APIs listed at How can I fire a key press or mouse click event without touching any input device at system level?. Dec 7, 2013 at 17:59
  • 2
    @Oded Nonsense. Not all questions about programming are “debug this code from me”. Dec 9, 2013 at 0:58

2 Answers 2


Is this the type of behavior we want on Stack Overflow?

Lets break this into the different kinds of behavior, as there are different things at work here and I would like to address each at a time.

one fun answer

Fun is OK, but this is more of a joke answer to a bad question than anything - personally, I would rather not see it at all. Making fun at the expense of the OP is not right, but can be the reaction when there is no effort shown.

non of them even provided a hint toward the solution

Great! We do not want to encourage people to ask off-topic, bad or otherwise unsuitable questions on Stack Overflow. Giving any sort of hint or answer teaches them that it is OK to post such questions on Stack Overflow - after all, they will get their answer, right?

Is anybody searching for the question in the future going to gain anything from us responding this way to questions?

When the question gets deleted, hopefully no one will see it. That is what should happen. What people gain is higher quality on the site.

The joke at the expense of the OP is not good and that shouldn't be tolerated.

In general, answers like this should be deleted. They serve no purpose.

  • The only thing that makes the question off topic is the lack of effort by the OP. But if we provide an asnwer (assuming it is not a dupe) then many people will benefit in the future. Should they all be punished because the OP did not show effort?
    – user000001
    Dec 7, 2013 at 11:23
  • 7
    @user000001 - The OP did not supply enough information, showed no code and you think this is a good question? If you are so concerned about the "loss of information", you can always write a better, well researched question of your own, and answer it, for the benefit of future visitors.
    – Oded
    Dec 7, 2013 at 11:26
  • 7
    @user000001 Answering bad questions invites bad questions.
    – Bart
    Dec 7, 2013 at 11:27
  • @Bart That is why we have the quality filter in place. Enough downvotes will do the job. My point was that a good answer may be helpful towards the community, despite the lack of effort by the OP. Who benefits from having questions un-answered?
    – user000001
    Dec 7, 2013 at 11:39
  • 3
    If the questions are bad, ultimately the site benefits from not having them answered. Granted, you don't end up with valuable content. But you also don't give the mistaken impression that crappy questions are welcome. And heck, why care about all this quality nonsense when you can get your immediate bad question answered anyway. By far the majority of users will have no immediate interest in long-term participation. Getting their question answered will be the only thing they're after.
    – Bart
    Dec 7, 2013 at 11:41
  • 1
    No, this is not a terrible question. It lacks information, and needed to be closed as such — but no one bothered to write a comment asking for that information, and a majority of close voters chose a nonsensical reason. Dec 9, 2013 at 0:56
  • I thought StackExchange hates fun?
    – Cole Tobin
    Dec 9, 2013 at 1:04

For the record, here's the question in the state it was deleted:

How can you programmatically simulate a keypress / mousemove?

I'm trying to write a program that simulates key-press events and/or mouse-move events, without any interaction by the user.

For example with a command like


a key press event would be sent to the focused window.

How can this be done in java or python?

You're doing the answer a bit of a disservice: while it is probably not the right answer for the asker's situation, a key-pressing robot is the way people who manufacture devices test user interaction. For a device with an external keyboard, it's easier to use a fake keyboard that generates events directly as signals on e.g. a PS/2 or USB bus, but some devices don't have external keyboards. This approach is only used when testing devices as a whole — when testing an application the right approach is of course to inject keyboard events at the OS or library stack level. So this is not purely a joke answer — but it deserves downvoting as not helpful.

Regarding the question, it's perfectly on-topic for SO — it's about programming. The question is incomplete because it doesn't say what operating system is being targeted. The answers are going to be completely different on different operating system. So the proper reaction to this question is to:

  • Vote to close as “unclear what you're asking — Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.”
  • Write a comment asking what operating system the asker is running.
  • Reopen the question once the missing information is added. If that information never comes, delete the question.

The question was closed as “Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself.” This makes no sense since this question does not concern a problem with code. It's a pretty common case of abuse of close reasons on Stack Overflow, unfortunately.

I've voted to undelete the question, because it isn't so bad that it needs to be deleted — it just required a little clarification, which no one bothered to ask for. Unfortunately, it's probably too late for this question — we've probably lost one more asker who might have asked a good question with just a little bit of guidance (that would have taken less time to write than the joke answer and all the associated comments).

  • For what it is worth, I was going to suggest using the Robot API (which is not platform dependent, btw). I hope your undelete vote doesn't expire before I reach 10K on SO! :). Had the asker properly formatted the question from revision 1, it would probably be received better. Anyway, CodeInChaos found a near dupe, so I guess it is not worth reponening before clarified.
    – user000001
    Dec 9, 2013 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .