Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
import win32con
from time import sleep
from os import error, system
from pyperclip import copy as pyper_copy, paste as pyper_paste
from ctypes.wintypes import MSG
import threading
timeout = 0.1
################# Key pressing area ####################
SendInput = ctypes.windll.user32.SendInput
# C struct redefinitions
PUL = ctypes.POINTER(ctypes.c_ulong)
class KeyBdInput(ctypes.Structure):
_fields_ = [("wVk", ctypes.c_ushort),
("wScan", ctypes.c_ushort),
("dwFlags", ctypes.c_ulong),
("time", ctypes.c_ulong),
("dwExtraInfo", PUL)]
class HardwareInput(ctypes.Structure):
_fields_ = [("uMsg", ctypes.c_ulong),
("wParamL", ctypes.c_short),
("wParamH", ctypes.c_ushort)]
class MouseInput(ctypes.Structure):
_fields_ = [("dx", ctypes.c_long),
("dy", ctypes.c_long),
("mouseData", ctypes.c_ulong),
("dwFlags", ctypes.c_ulong),
("time", ctypes.c_ulong),
("dwExtraInfo", PUL)]
class Input_I(ctypes.Union):
_fields_ = [("ki", KeyBdInput),
("mi", MouseInput),
("hi", HardwareInput)]
class Input(ctypes.Structure):
_fields_ = [("type", ctypes.c_ulong),
("ii", Input_I)]
# Actuals Functions
def PressKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008, 0, ctypes.pointer(extra))
x = Input(ctypes.c_ulong(1), ii_)
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
def ReleaseKey(hexKeyCode):
extra = ctypes.c_ulong(0)
ii_ = Input_I()
ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008 | 0x0002, 0, ctypes.pointer(extra))
x = Input(ctypes.c_ulong(1), ii_)
ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))
################# Key pressing area ####################
def hit_enter():
""" key presses for hitting enter """
PressKey(0x1c)
ReleaseKey(0x1c)
# time.sleep(timeOut) Falls immer noch blinken sollte
def press(key):
""" key presses for hitting enter """
PressKey(key)
sleep(timeout)
ReleaseKey(key)
# time.sleep(timeOut) Falls immer noch blinken sollte
def paste():
""" key presses for pasting """
PressKey(0x1D)
PressKey(0x2F)
sleep(timeout)
ReleaseKey(0x1D)
ReleaseKey(0x2F)
def spam():
""" key presses for pasting into chat """
hit_enter()
paste()
hit_enter()
class GlobalHotKeys(object):
key_mapping = []
user32 = ctypes.windll.user32
MOD_ALT = win32con.MOD_ALT
MOD_CTRL = win32con.MOD_CONTROL
MOD_CONTROL = win32con.MOD_CONTROL
MOD_SHIFT = win32con.MOD_SHIFT
MOD_WIN = win32con.MOD_WIN
@classmethod
def register(cls, vk, keyname, modifier=0, func=None):
indexof = [i for i, s in enumerate(cls.key_mapping) if vk in s]
if indexof != []:
del cls.key_mapping[indexof[0]]
# Called as a decorator?
if func is None:
def register_decorator(f):
cls.register(vk, keyname, modifier, f)
return f
return register_decorator
else:
cls.key_mapping.append((vk, keyname, modifier, func))
@classmethod
def unregister(cls, vk): # use vk number to delete from key_mapping
indexof = [i for i, s in enumerate(cls.key_mapping) if vk in s]
if indexof != []:
del cls.key_mapping[indexof[0]]
@classmethod
def listen(cls):
"""
Start the message pump
"""
for index, (vk, keyname, modifiers, func) in enumerate(cls.key_mapping):
if not cls.user32.RegisterHotKey(None, index, modifiers, vk):
# raise Exception('Unable to register hot key: ' + str(vk))
input("Can't assign {} as hotkey. Press Enter to continue...".format(keyname[3:]))
for index, (vk, keyname, modifiers, func) in enumerate(cls.key_mapping):
cls.user32.UnregisterHotKey(None, index)
return
try:
msg = MSG()
while cls.user32.GetMessageA(ctypes.byref(msg), None, 0, 0) != 0:
if msg.message == win32con.WM_HOTKEY:
(vk, keyname, modifiers, func) = cls.key_mapping[msg.wParam]
if not func:
break
func()
cls.user32.TranslateMessage(ctypes.byref(msg))
cls.user32.DispatchMessageA(ctypes.byref(msg))
finally:
for index, (vk, keyname, modifiers, func) in enumerate(cls.key_mapping):
cls.user32.UnregisterHotKey(None, index)
@classmethod
def _include_defined_vks(cls):
for item in win32con.__dict__:
item = str(item)
if item[:3] == 'VK_':
setattr(cls, item, win32con.__dict__[item])
@classmethod
def _include_alpha_vks(cls):
for key_code in (range(ord('A'), ord('Z') + 1)):
setattr(cls, 'VK_' + chr(key_code), key_code)
@classmethod
def _include_numeric_vks(cls):
for key_code in (range(ord('0'), ord('9') + 1)):
setattr(cls, 'VK_' + chr(key_code), key_code)
# https://gist.github.com/tracend/912308
att1 = 0x02
att2 = 0x03
att3 = 0x04
att4 = 0x05
att5 = 0x06
att6 = 0x12 # heal
att7 = 0x2E # mirror
att8 = 0x11 # mantra
att9 = 0x2F # dis
att0 = 0x1E # elit
attf1 = 0x3B
attf2 = 0x3C
attf3 = 0x3D
attf4 = 0x3E
tab = 0x29
init_time = float(-0.368)
global sleeper
global toggle
toggle=False
def timer(button, time):
time /= float(1000)
global sleeper
global toggle
if toggle:
sleep(float (time - sleeper))
print(float (time - sleeper))
sleeper = time
press(button)
else: exit()
def power_chrono():
#timer(timeout - 368)
timer(att5, 0)
timer(att7, 15)
timer(tab,32)
timer(att5,227)
timer(attf4,786)
timer(att9,1107)
timer(att3,1907)
timer(att6,2067)
timer(att5,3030)
timer(att9,3873)
timer(attf4,4707)
timer(att2,4708)
timer(att5,5594)
timer(att9,6508)
timer(att6,7307)
timer(att9,8227)
timer(att5,9107)
timer(att0,9862)
timer(tab,10629)
timer(att5,10870)
timer(att2,12989)
timer(att2,20864)
timer(tab,21631)
VKs = {"VK_F1":0x70,"VK_F2":0x71,"VK_F3":0x72,"VK_F4":0x73,"VK_F5":0x74,"VK_F6":0x75,"VK_F7":0x76,"VK_F8":0x77,"VK_F9":0x78,"VK_F10":0x79,"VK_F11":0x7A,"VK_F12":0x7B}
def add_key(aze):
button = "VK_F{}".format(aze)
keyValue = VKs.get(button)
@GlobalHotKeys.register(keyValue, button)
def f1():
global sleeper
global toggle
toggle = not toggle
sleeper = init_time
if toggle:
x = threading.Thread(target=deamon)
x.start()
def deamon():
while toggle:
print("--------------")
power_chrono()
global sleeper
sleeper = init_time
if __name__== "__main__":
bind = input("select binding key")
add_key(bind)
GlobalHotKeys.listen()
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team