mouse_keyboard_wechat_code

这里面有很多功能,关于微信,关于鼠标,关于键盘,关于编码等等,最好先把下面的代码保存为

mouse_keyboard_wechat_code.py
from pynput import keyboard, mouse
import time
from easygui import *
import turtle

k = keyboard.Controller()
m = mouse.Controller()


def author():
    import colorama
    import pyperclip
    color = [colorama.Fore.RED,
             colorama.Fore.GREEN,
             colorama.Fore.YELLOW,
             colorama.Fore.BLUE,
             colorama.Fore.CYAN,
             colorama.Fore.LIGHTRED_EX,
             colorama.Fore.LIGHTGREEN_EX,
             colorama.Fore.LIGHTYELLOW_EX,
             colorama.Fore.LIGHTBLUE_EX,
             colorama.Fore.LIGHTCYAN_EX
             ]
    for i in color:
        print(i + "作者流萤 此库始于2023/8/24 包名mouse_keyboard_wechat_code 运行时请加入代码...   " + colorama.Fore.BLUE + '详见弹窗')

    import turtle
    p = turtle.Pen()
    turtle.title('信息')
    turtle.bgcolor('skyblue')
    p.ht()
    p.up()
    p.lt(90)
    p.fd(300)
    p.rt(90)
    content = [
        '作者流萤',
        '库名:mouse_keyboard_wechat_code',
        '创作时间:2023/8/24',
        '关闭此弹窗后会复制此代码',
        '运行时请ctrl+V加入:',
        'import mouse_keyboard_wechat_code as mkwc',
        'm = mkwc.mouse()',
        'k = mkwc.keyboard()',
        'w = mkwc.wechat()',
        'c = mkwc.code()'
    ]
    for i in content:
        p.up()
        p.rt(90)
        p.fd(60)
        p.lt(90)
        p.write(i, align='center', font=('楷体', 30, 'normal'))
    turtle.done()
    pyperclip.copy("""
    import mouse_keyboard_wechat_code as mkwc
    m = mkwc.mouse()
    k = mkwc.keyboard()
    w = mkwc.wechat()
    c = mkwc.code()
    """)
class wechat():
    def openvx(self):
        from pynput import keyboard, mouse
        k.press(keyboard.Key.ctrl)
        k.press(keyboard.Key.alt)
        k.press('w')
        k.release('w')
        k.release(keyboard.Key.alt)
        k.release(keyboard.Key.ctrl)

    def opensearch(self):
        from pynput import keyboard, mouse
        k.press(keyboard.Key.ctrl)
        k.press('f')
        k.release('f')
        k.release(keyboard.Key.ctrl)

    def send_wechat(self):
        from pynput import keyboard, mouse
        ans = multenterbox('请选择', '选择', ['微信用户', '发送信息', '发送时间(如15:30:00)', '发送次数'])
        print(ans)
        vx = ans[0]
        msg = ans[1]
        send_time = ans[2]
        times = int(ans[3])
        while True:
            hour = time.localtime()
            now_time = time.strftime("%H:%M:%S", hour)
            if now_time == send_time:
                k.press(keyboard.Key.ctrl)
                k.press(keyboard.Key.alt)
                k.press('w')
                k.release('w')
                k.release(keyboard.Key.alt)
                k.release(keyboard.Key.ctrl)

                k.press(keyboard.Key.ctrl)
                k.press('f')
                k.release('f')
                k.release(keyboard.Key.ctrl)

                k.type(vx)
                time.sleep(1)
                k.press(keyboard.Key.enter)
                k.release(keyboard.Key.enter)
                time.sleep(1)
                for i in range(1, times + 1):
                    k.type(str(i) + '.' + msg)
                    k.press(keyboard.Key.enter)
                    k.release(keyboard.Key.enter)
                    time.sleep(0.2)
                break

    def voice_call(self):
        from pynput import keyboard, mouse
        k.press(keyboard.Key.ctrl)
        k.press(keyboard.Key.alt)
        k.press('w')
        k.release('w')
        k.release(keyboard.Key.alt)
        k.release(keyboard.Key.ctrl)
        msgbox('请打开微信全屏,3秒后开始语音通话')
        time.sleep(3)
        m.position = (1856, 918)
        m.press(mouse.Button.left)
        m.release(mouse.Button.left)
        msgbox('运行完毕')

    def video_call(self):
        from pynput import keyboard, mouse
        k.press(keyboard.Key.ctrl)
        k.press(keyboard.Key.alt)
        k.press('w')
        k.release('w')
        k.release(keyboard.Key.alt)
        k.release(keyboard.Key.ctrl)
        msgbox('请打开微信全屏,3秒后开始视频通话')
        time.sleep(3)
        m.position = (1878, 918)
        m.press(mouse.Button.left)
        m.release(mouse.Button.left)
        msgbox('运行完毕')

class keyboard():

    def key_type(self, string):
        k.type(str(string))

class mouse():
    def get_the_mouse_position_every_second(self):
        while True:
            print(m.position)
            time.sleep(1)

    def change_mouse_position(self, coordinate1, coordinate2):
        m.position = tuple((coordinate1, coordinate2))

    class click_the_mouse:
        def left(times=1):
            from pynput import mouse
            if times == 1:
                m.click(mouse.Button.left, 1)
            elif times == 2:
                m.click(mouse.Button.left, 2)
            else:
                msgbox('请输入1或2')

        def right():
            from pynput import mouse
            m.press(mouse.Button.right)
            m.release(mouse.Button.right)

        def middle():
            from pynput import mouse
            m.press(mouse.Button.middle)
            m.release(mouse.Button.middle)

        def scroll(a):
            try:
                m.scroll(0, a)
            except:
                msgbox('请检查,必须为数字')

class code():
    def morse_code(self):
        import colorama
        morse_dict = {
            'a': '.-',
            'b': '-...',
            'c': '-.-.',
            'd': '-..',
            'e': '.',
            'f': '..-.',
            'g': '--.',
            'h': '....',
            'i': '..',
            'j': '.---',
            'k': '-.-',
            'l': '.-..',
            'm': '--',
            'n': '-.',
            'o': '---',
            'p': '.--.',
            'q': '--.-',
            'r': '.-.',
            's': '...',
            't': '-',
            'u': '..-',
            'v': '...-',
            'w': '.--',
            'x': '-..-',
            'y': '-.--',
            'z': '--..',
            '0': '-----',
            '1': '.----',
            '2': '..---',
            '3': '...--',
            '4': '....-',
            '5': '.....',
            '6': '-....',
            '7': '--...',
            '8': '---..',
            '9': '----.',
            '@': '.--.-.',
            '&': '.-...',
            '!': '-.-.--',
            '?': '..--..',
            ' ': '..--',
            '[': '.-.-',
            ',': '--..--',
            '.': '.-.-.-',
            ']': '....-.',
            ';': '----',
            "'": '.----.',
            '-': '-....-'
        }
        while True:
            print(colorama.Fore.RESET+'[为enter,]为shift,;为backspace')
            m_ans = list(input().strip())
            print(m_ans)
            for i in range(len(m_ans)):
                m_ans[i] = colorama.Fore.RESET+morse_dict[m_ans[i]]+colorama.Fore.LIGHTBLUE_EX+'/'
            m_lst_ans = ''
            for i in m_ans:
                m_lst_ans += i
            print(m_lst_ans)

    def from_hex(self):
        import tkinter as tk
        def on_button_click(value):
            current_hex = hex_entry.get()
            hex_entry.delete(0, tk.END)
            hex_entry.insert(tk.END, current_hex + value)

        def de():
            current_hex = hex_entry.get()
            if current_hex != '0x':
                hex_entry.delete(0, tk.END)
                hex_entry.insert(tk.END, current_hex[:-1])

        def cl():
            hex_entry.delete(0, tk.END)
            hex_entry.insert(tk.END, "0x")

        def translate_hex():
            hex_input = hex_entry.get().replace(" ", "")
            try:
                hex_text = chr(int(hex_input[2:], base=16))
                text_output.config(state=tk.NORMAL)
                text_output.delete(1.0, tk.END)
                text_output.insert(tk.END, hex_text)
                text_output.config(state=tk.DISABLED)
            except ValueError:
                text_output.config(state=tk.NORMAL)
                text_output.delete(1.0, tk.END)
                text_output.insert(tk.END, "Invalid hex input")
                text_output.config(state=tk.DISABLED)

        root2 = tk.Tk()
        root2.title("Hex Translator")
        hex_entry = tk.Entry(root2, width=40)
        hex_entry.insert(tk.END, "0x")
        hex_entry.pack()
        button_frame = tk.Frame(root2)
        button_frame.pack()
        buttons = []
        for i in range(16):
            value = hex(i)[2:]
            button = tk.Button(button_frame, text=value, command=lambda value=value: on_button_click(value))
            button.grid(row=i // 4, column=i % 4)
            buttons.append(button)
        d_button = tk.Button(root2, text="删除", command=de)
        d_button.pack()
        translate_button = tk.Button(root2, text="翻译", command=translate_hex)
        translate_button.pack()
        c_button = tk.Button(root2, text="清空", command=cl)
        c_button.pack()
        text_label = tk.Label(root2, text="翻译结果:")
        text_label.pack()
        text_output = tk.Text(root2, width=40, height=10, state=tk.DISABLED)
        text_output.pack()
        root2.mainloop()

    def to_hex(self):
        import tkinter as tk

        def translate_to_hex():
            text = chinese_entry.get()

            hex_text = hex(ord(text))

            hex_output.config(state=tk.NORMAL)
            hex_output.delete(1.0, tk.END)
            hex_output.insert(tk.END, hex_text)
            hex_output.config(state=tk.DISABLED)

        root = tk.Tk()
        root.title("中文翻译成16进制")
        chinese_label = tk.Label(root, text="中文输入:")
        chinese_label.pack()
        chinese_entry = tk.Entry(root, width=40)
        chinese_entry.pack()
        translate_button = tk.Button(root, text="翻译", command=translate_to_hex)
        translate_button.pack()
        hex_label = tk.Label(root, text="16进制输出:")
        hex_label.pack()
        hex_output = tk.Text(root, width=40, height=10, state=tk.DISABLED)
        hex_output.pack()
        root.mainloop()

    def from_or_to_hex(self):
        while True:
            ans = buttonbox('请选择', '选择', ['汉→16', '16→汉'])
            if ans == '汉→16':
                code.to_hex()
            elif ans == '16→汉':
                code.from_hex()
            else:
                break

    def from_and_to_hex(self):
        import tkinter as tk

        def translate_to_hex():
            text = chinese_entry.get()

            hex_text = hex(ord(text))

            hex_output.config(state=tk.NORMAL)
            hex_output.delete(1.0, tk.END)
            hex_output.insert(tk.END, hex_text)
            hex_output.config(state=tk.DISABLED)

        root = tk.Tk()
        root.title("中文翻译成16进制")
        chinese_label = tk.Label(root, text="中文输入:")
        chinese_label.pack()
        chinese_entry = tk.Entry(root, width=40)
        chinese_entry.pack()
        translate_button = tk.Button(root, text="翻译", command=translate_to_hex)
        translate_button.pack()
        hex_label = tk.Label(root, text="16进制输出:")
        hex_label.pack()
        hex_output = tk.Text(root, width=40, height=10, state=tk.DISABLED)
        hex_output.pack()


        def on_button_click(value):
            current_hex = hex_entry.get()
            hex_entry.delete(0, tk.END)
            hex_entry.insert(tk.END, current_hex + value)

        def de():
            current_hex = hex_entry.get()
            if current_hex != '0x':
                hex_entry.delete(0, tk.END)
                hex_entry.insert(tk.END, current_hex[:-1])

        def cl():
            hex_entry.delete(0, tk.END)
            hex_entry.insert(tk.END, "0x")

        def translate_hex():
            hex_input = hex_entry.get().replace(" ", "")
            try:
                hex_text = chr(int(hex_input[2:], base=16))
                text_output.config(state=tk.NORMAL)
                text_output.delete(1.0, tk.END)
                text_output.insert(tk.END, hex_text)
                text_output.config(state=tk.DISABLED)
            except ValueError:
                text_output.config(state=tk.NORMAL)
                text_output.delete(1.0, tk.END)
                text_output.insert(tk.END, "Invalid hex input")
                text_output.config(state=tk.DISABLED)

        root2 = tk.Toplevel(root)
        root2.title("Hex Translator")
        hex_entry = tk.Entry(root2, width=40)
        hex_entry.insert(tk.END, "0x")
        hex_entry.pack()
        button_frame = tk.Frame(root2)
        button_frame.pack()
        buttons = []
        for i in range(16):
            value = hex(i)[2:]
            button = tk.Button(button_frame, text=value, command=lambda value=value: on_button_click(value))
            button.grid(row=i // 4, column=i % 4)
            buttons.append(button)
        d_button = tk.Button(root2, text="删除", command=de)
        d_button.pack()
        translate_button = tk.Button(root2, text="翻译", command=translate_hex)
        translate_button.pack()
        c_button = tk.Button(root2, text="清空", command=cl)
        c_button.pack()
        text_label = tk.Label(root2, text="翻译结果:")
        text_label.pack()
        text_output = tk.Text(root2, width=40, height=10, state=tk.DISABLED)
        text_output.pack()
        root.mainloop()

    def regular_expression(self):
        import re
        import webbrowser
        import easygui
        from tkinter import messagebox
        import tkinter
        root = tkinter.Tk()
        root.withdraw()

        match_ans = ''
        match_ques = ['', '', '']
        lmatch_ans = 0
        replace_ans = ''
        replace_ques = ['', '', '', '']
        while True:
            ans = buttonbox('请选择功能', '选择', ['教程', '匹配表达式', '替换文本'])
            if ans == '教程':
                webbrowser.open('https://www.runoob.com/regexp/regexp-tutorial.html')
            elif ans == '匹配表达式':
                while True:
                    match_ques = easygui.multenterbox('请输入', '匹配表达式', ['请输入表达式', '请输入文本', '结果'], [match_ques[0], match_ques[1], f'共匹配{lmatch_ans}项{match_ans}'])
                    if match_ques == None:
                        match_ans = ''
                        match_ques = ['', '', '']
                        lmatch_ans = 0
                        break
                    else:
                        try:
                            match_ans = re.findall(match_ques[0], match_ques[1])
                            lmatch_ans = len(match_ans)
                        except:
                            messagebox.showerror('错误', '正则表达式输入错误')
            elif ans == '替换文本':
                while True:
                    replace_ques = easygui.multenterbox('请输入', '替换文本', ['请输入文本', '请输入要替换的文本', '请输入替换内容', '结果'], [replace_ques[0], replace_ques[1], replace_ques[2], replace_ans])
                    if replace_ques == None:
                        replace_ans = ''
                        replace_ques = ['', '', '', '']
                        break
                    else:
                        try:
                            replace_ans = str(replace_ques[0]).replace(replace_ques[1], replace_ques[2])
                        except:
                            messagebox.showerror('错误', '无法替换')
            else:
                break

然后新建文件(必须确保这个文件和mouse_keyboard_wechat_code.py在同一文件夹)输入

import mouse_keyboard_wechat_code as mkwc
mkwc.author()

就知道怎么使用了

喜欢就支持一下吧 

点击这里支持作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值