Check out our Monthly Survey Page to see what our users are running.
Autokey "new script"
Spirimint commented on 15 January 2020 at 10:57 am UTC

Hey, i hope I'm in the right section.

I want to change some buttons for one game (settler 7). The buttons to rotate the camera are "end" and "del". It so uncomfortable so i want to change the to "q" and "e"

To do this i found the programm " autokey".

I want to make a script. But its just not working. Is there any website, to learn scripting for autokey?

Or maybe an even easier solution?

Last edited by Spirimint on 15 January 2020 at 10:59 am UTC

Salvatos commented on 15 January 2020 at 2:06 pm UTC

I haven’t tried scripting with AutoKey (I only use it for string replacement), but they have a wiki on github if it helps. I got something working based on this sample: https://github.com/autokey/autokey/wiki/Scripting#persistent-value

Chances are your distribution or desktop environment has a GUI tool for this somewhere, but if not, you could write a pretty simple script and have Autokey run it when you use your chosen shortcut. You can search for "key swapping" or "key remapping" and find plenty of tutorials. First, you want to run xmodmap -pk to figure out the right codes for your keys. You’re looking for the number code (KeyCode Value) and the name of the key (KeySym Name). Then, using xmodmap -e "keycode 52 = e" && xmodmap -e "keycode 26 = z" for example will switch the values for E (normally 26 on my keyboard) and Z (normally 52). Making Autokey run that for you would look like this:

if store.get_value("runs") == 1:
    output = system.exec_command('xmodmap -e "keycode 52 = e" && xmodmap -e "keycode 26 = z"') 
    store.set_value("runs", 0)
else: 
    output = system.exec_command('xmodmap -e "keycode 52 = z" && xmodmap -e "keycode 26 = e"')
    store.set_value("runs", 1)


The condition makes it so that each time you execute that shortcut, it will alternate states, so you could run it once before you play, then a second time when you’re done to return to normal. I believe the changes would revert anyway at the end of your user session if you forget to turn it off.

Hope that helps!

Last edited by Salvatos on 15 January 2020 at 5:20 pm UTC

Spirimint commented on 15 January 2020 at 4:41 pm UTC

This is awesome! I managed to make it with

xmodmap -e "keycode 26 = Delete"
xmodmap -e "keycode 115 = e"
xmodmap -e "keycode 24 = End"
xmodmap -e "keycode 119 = q"


and after i reboot my Os everything is normal again!!!

This is sooo good!

You need to Register and Login to comment, submit articles and more.


Or login with...

Livestreams & Videos
Community Livestreams
Popular this week
View by Category
Contact
Latest Comments
Latest Forum Posts