How to use remote control with bash script .sh?
#1
How to use remote control with bash script .sh?

I want to control the mouse with the keyboard keys.

Are there any methods?

I tried to use such code:
python:

#!/bin/bash

wid=`xdotool search --onlyvisible --name 'chrome'`
if [ "$wid" != "" ]; then
    if  [ 'LEFT_BUTTON' ]; then
        xdotool mousemove_relative 20 0
    fi
fi

but nothing works((((

How to track keystrokes correctly?
Reply
#2
Here you go, for example:
python:

#!/bin/bash
while true; do

read -s -n 1 action

if  [ "$action" == $'a' ]; then
    xdotool mousemove_relative -- -20 0
elif [ "$action" == $'d' ]; then
    xdotool mousemove_relative 20 0
elif [ "$action" == $'w' ]; then
    xdotool mousemove_relative 0 -20
elif [ "$action" == $'s' ]; then
    xdotool mousemove_relative 0 20
elif [ "$action" == $'r' ]; then
    xdotool click 1
elif [ "$action" == $'x' ]; then
    exit 0
fi

done

Remember, this forum does not help quickly!
I always criticize and always will criticize what is badly thought out and does not work well.
Reply
#3
The best option for you:

python:

#!/bin/bash

device='/dev/input/by-id/usb-Targus_Laser_Presentation_Remote-if02-event-kbd'

event_blank='*code 48 (KEY_B), value 1*'
event_esc='*code 1 (KEY_ESC), value 1*'
event_f5='*code 63 (KEY_F5), value 1*'
event_prev='*code 104 (KEY_PAGEUP), value 1*'
event_next='*code 109 (KEY_PAGEDOWN), value 1*'

evtest "$device" | while read line; do
case $line in
($event_blank) echo "BLANK SCREEN" ;;
($event_f5) echo "F5" ;;
($event_esc) echo "ESCAPE" ;;
($event_prev) echo "PREVIOUS" ;;
($event_next) echo "NEXT" ;;
esac
done

Such a big forum, and so little help. Sloths!
I always criticize and always will criticize what is badly thought out and does not work well.
Reply
#4
@gezosepite - if you continue with these snide little digs in your posts, you will earn yourself a ban.

This is your second warning - three strikes and you're out.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#5
(2019-04-16, 23:25)gezosepite Wrote: Such a big forum, and so little help. Sloths!

You're always free to visit another forum where people are more up to "your standard".

By the way, I normalized your obnoxious signature. This is not the gezosepite forum.
We prefer to have the main focus on the forum posts, not so much who has the biggest d*** signature around here.
Reply
#6
(2019-04-17, 09:34)DarrenHill Wrote: @gezosepite - if you continue with these snide little digs in your posts, you will earn yourself a ban.

This is your second warning - three strikes and you're out.

Oh, scared! I do not care!
I always criticize and always will criticize what is badly thought out and does not work well.
Reply
#7
(2019-04-17, 09:55)Klojum Wrote:
(2019-04-16, 23:25)gezosepite Wrote: Such a big forum, and so little help. Sloths!

You're always free to visit another forum where people are more up to "your standard".

By the way, I normalized your obnoxious signature. This is not the gezosepite forum.
We prefer to have the main focus on the forum posts, not so much who has the biggest d*** signature around here. 
Thank you for your opinion!
I always criticize and always will criticize what is badly thought out and does not work well.
Reply

Logout Mark Read Team Forum Stats Members Help
How to use remote control with bash script .sh?0