1

In autohotkey I have used Run command to open window or files. Is there any way for the same task in autokey.

In my case I have to open folder and create a folder with name sample. my not working code is

system.exec_command('/home/dinom/Documents/testfolder', getOutput=True)
keyboard.send_keys("<ctrl>+<shift>+<n>")
keyboard.send_keys("sample")
keyboard.send_keys("<enter>")

How to do this in autokey.

2 Answers 2

0

if you simply need to create a directory, you could use this:

system.exec_command('mkdir -vp /home/dinom/Documents/testfolder/sample')

then to open your filebrowser to that new directory location:

import subprocess
subprocess.call(['xdg-open', '/home/dinom/Documents/testfolder/sample'])
0

Check the following code

import os
os.system('/usr/bin/xdg-open /home/dinom/Documents/testfolder')
import time
time.sleep(1)
window.activate("testfolder",switchDesktop=True)
import subprocess
active_title =window.get_active_title() 
time.sleep(1) 
if (active_title == "testfolder"):
    start_time = time.time()
    keyboard.wait_for_keypress("n", timeOut=1)
    if (time.time()-start_time < 0.9):
        time.sleep(0.2)
    keyboard.press_key("<ctrl>")
    keyboard.press_key("<shift>")
    keyboard.press_key("n")
    keyboard.release_key("n")
    keyboard.release_key("<ctrl>")
    keyboard.release_key("<shift>")
    time.sleep(4)
    keyboard.send_keys("sample")
    keyboard.send_keys("<enter>")
else:
    subprocess.Popen(['notify-send', "Couldn't find testfolder"]) 

Use this link for reference

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .