View previous topic :: View next topic |
Author |
Message |
tkzv Tux's lil' helper
Joined: 22 Aug 2014 Posts: 89
|
Posted: Mon Sep 23, 2024 1:29 pm Post subject: [SOLVED] GUI automation macros |
|
|
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 |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22636
|
Posted: Mon Sep 23, 2024 2:00 pm Post subject: |
|
|
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 |
|
|
tkzv Tux's lil' helper
Joined: 22 Aug 2014 Posts: 89
|
Posted: Mon Sep 23, 2024 2:13 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|