Domanda

Is it possible to run an AutoKey script with input parameters? (e.g autokey-run -s scriptname param1 param2 ...) I've tried using sys.argv, but for some reason, when running the script through AutoKey (as opposed to through python), argv[0] just contains the string "/usr/local/bin/autokey-gtk", and all other indices are empty. Is there another way to do it?

Here's some sample code:

import sys
keyboard.send_keys(sys.argv[0])
--
$ autokey-run -s scriptname testparam
>>/usr/local/bin/autokey-gtk

I'm aware this is an odd use of AutoKey, but I need it for its ability to send keyboard events.

È stato utile?

Soluzione

I solved this problem by writing a bash function that wrote the arguments to a temp file, ran the autokey script, then deleted the file. I've had no issues with that solution thus far.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top