1

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.

whereswalden
  • 4,301
  • 3
  • 24
  • 36

1 Answers1

1

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.

whereswalden
  • 4,301
  • 3
  • 24
  • 36
  • would you share the script? – SL5net Sep 01 '20 at 09:44
  • @SL5net Unfortunately the script was on a machine owned by an employer, and I haven't worked there for 6 years. The script was fairly straightforward though. Is there anything I can clarify about the solution? – whereswalden Sep 02 '20 at 14:50