Automation

Autokey script tricks for Ubuntu 20.4

September 16, 2020 4:50 PM
Author: Svitlana Shepitsena
Main illustration for Autokey script tricks for Ubuntu 20.4 blog post

Problem: AutoKey Scripts throw an error after updating to Ubuntu 20.4.
Before the scripts used to work just perfectly.

My Script:

# Enter script code
import time
system.exec_command('gnome-terminal', getOutput=True)
time.sleep(0.2)
keyboard.send_keys('text command')
time.sleep(0.5)
keyboard.send_keys('<enter>')

 

Error:

Script name: 'open synology elastic search ssh'
Traceback (most recent call last):
File "/usr/lib/python3/dist-package/autokey/service.py", line 485, in execute ecec(script.code, scope)
File "<string>", line 3, in <module>
File "/usr/lib/python3/dist-package/autokey/service.py", line 497, in exec_command
if output[-1]=="/n":
InexError: string index out of range

 

AutoKey Script error on Ubuntu 20.4

Solution:

1. Change getOutput to False

2. Increase time.sleep at least to 0.5 (in my case I made a decision to play safe and set 1)

 

AutoKey Documentation:

https://autokey.github.io/lib.scripting-module.html

https://github.com/autokey/autokey

https://code.google.com/archive/p/autokey/

 

Tags

autokey
ubuntu
python3
python-3
time.sleep
automation
Andriy Shepitsen
Useful tricks.

<RealSiter/>
We speak English, Ukrainian, Russian