Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] GUI automation macros
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
tkzv
Tux's lil' helper
Tux's lil' helper


Joined: 22 Aug 2014
Posts: 89

PostPosted: Mon Sep 23, 2024 1:29 pm    Post subject: [SOLVED] GUI automation macros Reply with quote

Is there a tool that can repeatedly send a sequence of keypresses to a window? Preferably, Qt or KDE rather than Gnome. Something like "Menu, Down, Down, Enter, Left, Shift-Ins, Enter, Down". The suggestions I found at Stackoverflow are all absent in modern Gentoo.

Or maybe someone can tell how to mass rename files in QBittorrent?

Solution: x11-misc/xdotool. Drawbacks: only works for QBittorrent when its window is active; Shift with cursor keys does not select text in Qt editboxes; default delay 12 ms is not enough. I ended up using "key BackSpace" to delete text and running this line in console:
Code:
sleep 1s; for n in {1..98}; do xdotool key --delay 100 Menu Down Down Down Enter End BackSpace BackSpace BackSpace Shift+Insert Enter Down; done


Last edited by tkzv on Mon Sep 23, 2024 3:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22640

PostPosted: Mon Sep 23, 2024 2:00 pm    Post subject: Reply with quote

You want a tool to do something in X? Would xdotool suffice? :)

Though in my opinion, you would be better off not trying to automate a GUI like this, as you could get hilariously wrong results if any key sequence is lost/misunderstood by the target, since your macro generation tool cannot see whether it is still getting the desired results. I suggest letting QBittorrent name the files as it likes, and then performing a bulk rename later. mmv is a common solution for this, but you can also do it with a simple bash script. If you provide some sample input/output pairs, someone here will probably take it as a challenge to find a solution for you.
Back to top
View user's profile Send private message
tkzv
Tux's lil' helper
Tux's lil' helper


Joined: 22 Aug 2014
Posts: 89

PostPosted: Mon Sep 23, 2024 2:13 pm    Post subject: Reply with quote

Hu wrote:
You want a tool to do something in X? Would xdotool suffice? :)


Thanks.

Hu wrote:
Though in my opinion, you would be better off not trying to automate a GUI like this, as you could get hilariously wrong results if any key sequence is lost/misunderstood by the target, since your macro generation tool cannot see whether it is still getting the desired results.


If I map a sequence to a single keypress, it will go wrong only once at worst. I do have some experience with that sort of things :)

Hu wrote:
I suggest letting QBittorrent name the files as it likes, and then performing a bulk rename later.


I want to be able to use the files with names convenient to me, but continue seeding them as long as possible. QBittorrent allows that.

Hu wrote:
mmv is a common solution for this, but you can also do it with a simple bash script. If you provide some sample input/output pairs, someone here will probably take it as a challenge to find a solution for you.

In this case simple rename from sys-apps/util-linux is enough.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum