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.

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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.