Hi :) I use autokey on raspberry pi os.
I just want to use autokey script(autokey-run -s autokeyscript
) with crontab (when reboot)
However, there are some errors.
I have already tried export DISPLAY=:0
.
But the same error log appears.
the crontab log
File "/usr/bin/autokey-run", line 34, in <module>
bus = dbus.SessionBus()
File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 211, in __new__
mainloop=mainloop)
File "/usr/lib/python2.7/dist-packages/dbus/_dbus.py", line 100, in __new__
bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 122, in __new__
bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
display started
Autokey script
import time
image_path = '/dir/'
image_name = 'python file'
time.sleep(5)
# Open Terminal and run python script
# I know that I can run python script without autokey with using crontab, but I have to do this with this method.
keyboard.send_keys('<ctrl>+<alt>+t')
keyboard.send_keys(image_path)
keyboard.send_keys('<enter>')
time.sleep(3)
#keyboard.send_keys('<ctrl>+f')
keyboard.send_keys(image_name)
keyboard.send_keys('<enter>')
time.sleep(3)
keyboard.send_keys('<enter>')