Random mouse cursor and any keyboard keypress to stop that random cursor code

Hi everybody!

I would like to create a script that moves the mouse cursor randomly within 100x100 pixel, in every 2 seconds, and if i press any key on keyboard, then i get back my mouse control.

Why? What does this have to do with Blender?

well you can do it by using an external library called pyautogui and a model operator

Nothing. Sounds like they’re writing a practical joke app.

Or they have some productivity spyware watching them,…

Don’t judge, this is an open minded community :smiley:
So without installing pyautogu i can’t do it, right?

Cheers!

I’m not judging, I’m asking what this has to do with Blender. You posted on a Blender forum in the Blender Python API support section

I would look into autohotkey for this. There’s probably dozens of existing scripts to accomplish this task.

1 Like

And be aware that if you’re using this to try and circumvent employee productivity monitoring software, it won’t work and you’ll get in significantly more trouble for trying to cheat the system. Most companies consider that grounds for immediate termination. Just FYI

1 Like

It should be pretty straightforward with a modal operator, but the 100*100 pixel wide part would complicate it a bit. Where would you want it to happen ?

Also, I’m actually not sure the cursor moving would trigger as a “mouse move” event by your operating system in case you want this script to circumvent an aforementioned third party software :wink:

1 Like

I tried, and yeah it’s not kicking in the os if it goes to sleep.
Anyhow cheers for the replies!

Get a USB mouse, take the motor out of an electric toothbrush, and tape it on. Done

2 Likes

Or get an Arduino. You can program those to be a usb input, including making mouse movements.

2 Likes

I was going to say that, but you can get an electric toothbrush at the dollar store, and every dollar counts when you’re about to get fired :wink:

4 Likes

Can you control the tooth brush with the Blender API though? :smiley:

1 Like

Probably not a dollar store one, but they have some pretty fancy ones out there, I’m sure the $100+ ones have a Linux distro running some kind of Python :sweat_smile:

1 Like

Jokes aside, let me give an approximation of the email you’re getting to get in a few days unless you take a step back and decide not to ruin your life, @nyalka_nyalka

“It’s come to our attention that after posting on a public Internet forum using an email address and IP address known to be yours, looking for ways to circumvent our productivity monitoring software, we’ve found a script called ‘suckonthisboss.py’ running on your work computer. Our network monitoring software has found that you’re watching Netflix on your personal phone while using this script to pretend to work. Installing unauthorized software, planned deceit, and time theft constitute a breach of your employment contract. You are terminated immediately. You will not be eligible for unemployment benefits, as your conduct is considered gross misconduct under unemployment law, and we will inform any future employers of your conduct.

We will be launching a thorough investigation into all your activities at this company, and if we find any evidence that you’ve harmed the company or company property, we will pursue the fullest remedies permissible by law against you.”

Don’t do this to yourself. Best case scenario, you never get a job in your field again. Worst case, you go to jail.

2 Likes

Well… we are really open minded… (even if this might have nothing to do with blender…) :grin:

…there some “weird” reasons to “use” something like this…

Most companies employ strict session idle times that will disconnect you when you’re away from your computer, resulting in you having to reconnect all over again.

…then this is the most bat-guano like idea of the company… because reconnecting costs time → money… so the employee spends “company time” to reconnect !?

( Also those are the “user solutions” the IT-department really hates… because this makes them also more work… we think we are under cyber attack because of the unusal “user activity” we noticed the last days… )

But/And also then… installing “something” on company computers…