Thread: Odds and ends
View Single Post
Posts: 1,101 | Thanked: 1,185 times | Joined on Aug 2008 @ Spain
#172
Originally Posted by Addison View Post
Okay, so going back on my previous question...

I can finally get an F3 signal sent 100% of the time now if I have this in my script.

xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'
xte 'keydown F3' 'keyup F3'

I don't understand why I have to force this so many times.

Besides that, it's a little laggy doing it this way.

Any possible clues or a different direction I can take here?

Kind regards.
Instead of sending a stream of fast key pressings, try to send the keydown event, wait a bit, and then the keyup event. May be that works
Code:
xte 'keydown F3'
/usr/share/snx/usleep 100000
xte 'keyup F3'
Since "sleep" in ash only accepts an integer number of seconds, I'm using here usleep (which I provide with snx and accepts a number of microseconds).
Unless you use bash to run your script, then you could use sleep
Code:
#!/bin/bash
#your script stuff...
xte 'keydown F3'
sleep 0.1
xte 'keyup F3'
 

The Following 2 Users Say Thank You to maacruz For This Useful Post: