Created
August 9, 2020 06:12
-
-
Save sl5net/f68d302f0f5a40d05e6a2e182b453a51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import subprocess | |
# first_title = window.get_active_title() | |
first_class = window.get_active_class() | |
# keyboard.send_keys("\n#1 first_class='%s'" % first_class) | |
#1 first_class='autokey-gtk.Autokey-gtkinitialContent' | |
# hi world | |
# This is Snippet Part 1, refer to documentation for further info. | |
# leider Formatierung hier zerstoehrt. Ich machs irgendwann online. | |
# | |
# hi world hi world | |
# hi worldhi worldhi worldhi world | |
try: | |
subprocess.Popen(["/bin/bash", "/home/administrator/Desktop/test.sh"]) | |
except subprocess.CalledProcessError: | |
time.sleep(0.2) | |
for i in range(0, 30): | |
time.sleep(0.1) | |
active_class = window.get_active_class() | |
if active_class != first_class: | |
break | |
timeValueInLoopInSec = 0.2 | |
timeValueForBREAKLoopInSec = 20 | |
#hihihihi hi world | |
for x in range(0, 900): # default is 25 | |
if timeValueForBREAKLoopInSec < x * timeValueInLoopInSec: | |
keyboard.send_keys("BREAK x is '%s'" % str(x)) # <= too check the last x value if interessted in | |
break | |
# active_title = window.get_active_title() | |
active_class = window.get_active_class() | |
#if active_title == first_title and active_class == first_class: | |
if active_class == first_class: | |
# keyboard.fake_keypress('<left>') # posibility to show script is working. https://code.google.com/archive/p/autokey/wikis/SpecialKeys.wiki | |
break | |
time.sleep(timeValueInLoopInSec) | |
cNew = "initialContent" | |
try: | |
# cNew = clipboard.get_clipboard() # found here: https://github.com/autokey/autokey/wiki/Scripting#create-new-abbreviation | |
# time.sleep(0.4) | |
keyboard.fake_keypress('<control>') # posibility to show script is working. https://code.google.com/archive/p/autokey/wikis/SpecialKeys.wiki | |
keyboard.press_key('<ctrl>') | |
keyboard.fake_keypress('v') | |
keyboard.release_key('<ctrl>') | |
#hi world | |
# hi worldhi world leider Formatierung hier zerstöhrt. Ich machs irgendwann online. | |
# https://stackoverflow.com/questions/11184300/autokey-clipboard-get-selection-function-fails-on-certain-strings | |
# use a clipboard function to paste the modified string back into your App. | |
# ö oe | |
# cNew.replace("ö", "oe") | |
except: | |
time.sleep(0.1) | |
#initialContenhi worldt hi world | |
#initialContenhi worldt | |
# initialContenhi worldt hi world | |
time.sleep(0.4) | |
# keyboard.send_keys(cNew) | |
# keyboard.fake_keypress('<left>') # posibility to show script is working. https://code.google.com/archive/p/autokey/wikis/SpecialKeys.wiki | |
# keyboard.fake_keypress('<left>') # posibility to show script is working. https://code.google.com/archive/p/autokey/wikis/SpecialKeys.wiki | |
# | |
# str = "\n# <AutoKey:active_title=" + active_title + ",active_class=" + active_class + ">" | |
# if active_title == "administrator^ Lintalist - 1.9.13" and active_class == "autohotkey.exe.Wine": | |
# <AutoKey:active_title=administrator^ Lintalist - 1.9.13,active_class=autohotkey.exe.Wine> | |
# the following f-keys commands are working: | |
# keyboard.fake_keypress('<f4>') # edit snippet | |
# keyboard.fake_keypress('<f5>') # copy snippet | |
# keyboard.fake_keypress('<f5>') # move snippet | |
# keyboard.fake_keypress('<f7>') # new snippet | |
# keyboard.fake_keypress('<f8>') # remove snippet | |
# keyboard.fake_keypress('<f10>') # manage bundels |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment