Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# apps: xclip,xdotool,zenity
import time
def new_item_categ_other():
keyboard.send_keys("other")
time.sleep(1.00)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<down>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(1.3)
os.system("sleep 0.3; xdotool key Alt_L+Return")
time.sleep(1)
# ask for name
time.sleep(.5)
user_name = "zenity --entry --title='Input' --text='Name The Item -> Example: AutoKey'"
time.sleep(2)
type_name = system.exec_command(user_name)
time.sleep(2)
# end - ask for name
# prop2_copy_command()
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
prop2_1 = "x=$(xclip -o);sleep 0.50;echo $x"
type_prop2_1 = system.exec_command(prop2_1)
time.sleep(0.50)
keyboard.send_keys("<escape>")
time.sleep(0.50)
# end - prop2_copy_command()
os.system("sleep 0.3; xdotool key Alt_L+Return")
time.sleep(1)
#prop3_appimage()
keyboard.send_keys("<ctrl>+c")
time.sleep(0.80)
prop3_1 = "x=$(xclip -o);sleep 0.50;echo $x"
type_prop3_1 = system.exec_command(prop3_1)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<ctrl>+c")
time.sleep(0.80)
prop3_2 = "x=$(xclip -o);sleep 0.50;echo $x"
type_prop3_2 = system.exec_command(prop3_2)
time.sleep(0.50)
keyboard.send_keys("<escape>")
time.sleep(0.50)
# end - prop3_appimage()
os.system("sleep 0.3; xdotool key Alt_L+Return")
time.sleep(1)
# prop4_2tabs_selectname_ex_copyq()
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<ctrl>+c")
time.sleep(0.80)
prop4_1 = "x=$(xclip -o);sleep 0.50;echo $x"
type_prop4_1 = system.exec_command(prop4_1)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<ctrl>+c")
time.sleep(0.80)
prop4_2 = "x=$(xclip -o);sleep 0.50;echo $x"
type_prop4_2 = system.exec_command(prop4_2)
time.sleep(0.50)
keyboard.send_keys("<escape>")
time.sleep(0.50)
# end - prop4_2tabs_selectname_ex_copyq()
# open menu editor
os.system("cinnamon-menu-editor &")
time.sleep(1.7)
activeWindow = window.get_active_title()
time.sleep(1.7)
if 'Main Menu' in activeWindow: # wait 1 for main menu
done = 1
new_item_categ_other()
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop2
keyboard.send_keys(type_prop2_1)
time.sleep(0.50)
# check launcher - prop2
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end check launcher - prop2
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop3
keyboard.send_keys(type_prop3_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop3_1)
time.sleep(0.50)
# check launcher - prop3
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop3
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop4
keyboard.send_keys(type_prop4_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop4_1)
time.sleep(0.50)
# check launcher - prop4
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop3
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
# prop1 = prop3 with xdg-open
keyboard.send_keys("xdg-open '")
time.sleep(0.50)
keyboard.send_keys(type_prop3_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop3_1)
time.sleep(0.50)
keyboard.send_keys("'")
# check launcher - prop1
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop4
if done == 0:
dialog.info_dialog("Script 6.4 for AutoKey", "File Is Not Supported." , width = '250')
quit()
else:
win = 0
if win == 0:
time.sleep(2)
activeWindow = window.get_active_title()
time.sleep(1.50)
if 'Main Menu' in activeWindow: # wait 2 for main menu
new_item_categ_other()
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop2
keyboard.send_keys(type_prop2_1)
time.sleep(0.50)
# check launcher - prop2
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end check launcher - prop2
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop3
keyboard.send_keys(type_prop3_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop3_1)
time.sleep(0.50)
# check launcher - prop3
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop1
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
#prop4
keyboard.send_keys(type_prop4_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop4_1)
time.sleep(0.50)
# check launcher - prop4
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop3
if done == 0:
# fill in
keyboard.send_keys(type_name)
time.sleep(0.50)
keyboard.send_keys("<tab>")
time.sleep(0.50)
# prop1 = prop3 with xdg-open
keyboard.send_keys("xdg-open '")
time.sleep(0.50)
keyboard.send_keys(type_prop3_2)
time.sleep(0.50)
keyboard.send_keys("/")
time.sleep(0.50)
keyboard.send_keys(type_prop3_1)
time.sleep(0.50)
keyboard.send_keys("'")
# check launcher - prop1
time.sleep(0.30)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.1)
keyboard.send_keys("<tab>")
time.sleep(0.30)
keyboard.send_keys("<enter>")
time.sleep(2.5)
activeWindow = window.get_active_title()
if 'Main Menu' in activeWindow:
done = 1
keyboard.send_keys("<escape>")
time.sleep(0.30)
os.system("notify-send 'Add New Item to App Menu' 'Done!'")
quit()
else:
done = 0
time.sleep(0.2)
keyboard.send_keys("<escape>")
time.sleep(0.3)
keyboard.send_keys("<escape>")
time.sleep(1)
keyboard.send_keys("<enter>")
time.sleep(2)
# end - check launcher - prop4
if done == 0:
dialog.info_dialog("Script 6.4 for AutoKey", "File Is Not Supported." , width = '250')
else:
dialog.info_dialog("Script 6.4 for AutoKey", "Main Menu (Active Window) Not Found, Run Script Again." , width = '320')
quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment