banner
andrewji8

Being towards death

Heed not to the tree-rustling and leaf-lashing rain, Why not stroll along, whistle and sing under its rein. Lighter and better suited than horses are straw sandals and a bamboo staff, Who's afraid? A palm-leaf plaited cape provides enough to misty weather in life sustain. A thorny spring breeze sobers up the spirit, I feel a slight chill, The setting sun over the mountain offers greetings still. Looking back over the bleak passage survived, The return in time Shall not be affected by windswept rain or shine.
telegram
twitter
github

Python one-line code to achieve WeChat multiple opening.

Before running the code, download the wftools library with the following command:

pip install wftools

After installation, use the wftools module:

import wftools

soft_path = r"D:\ 微信 \WeChat\WeChat.exe"
wftools.open_soft(soft_path=soft_path, num=2)

Here, replace soft_path with the storage location of WeChat.exe on your computer, and replace num with the number of WeChat instances you want to open.

Graphical interface version:

import tkinter as tk
import windnd
import win32com.client
import wftools

def handle_drag(files):
    text.delete("1.0", "end")
    for file in files:
        file = file.decode("gbk")
        target_path = get_shortcut_target(file)
        text.insert("insert", target_path + "\n")

def get_shortcut_target(path):
    shell = win32com.client.Dispatch("WScript.Shell")
    shortcut = shell.CreateShortCut(path)
    target_path = shortcut.Targetpath
    return target_path

def start_program():
    quantity = int(quantity_entry.get())
    soft_path = text.get("1.0", "end").strip()
    wftools.open_soft(soft_path=soft_path, num=quantity)

root = tk.Tk()
root.title("WeChat Multi-Opening Tool")
root.geometry("410x200")
root.resizable(False, False)

text = tk.Text(root, width=60, height=3, font=("Arial", 12))
text.pack(padx=10, pady=10)

windnd.hook_dropfiles(root, func=handle_drag)

quantity_label = tk.Label(root, text="Quantity:", font=("Arial", 12))
quantity_label.pack()

quantity_entry = tk.Entry(root, font=("Arial", 12))
quantity_entry.insert(0, "2")
quantity_entry.pack()

start_button = tk.Button(root, text="Start", command=start_program, font=("Arial", 12), bg="lightblue", fg="white")
start_button.pack(pady=10)

root.mainloop()

First, we create a function called handle_drag to handle file drag and drop events. When a user drags and drops files onto the window, this function clears the contents of the text box and processes each dropped file one by one. For each file, it decodes the file path as GBK encoding and uses the get_shortcut_target function to get the target path of the shortcut. Then, it inserts the target path into the text box.

Next, we define a function called get_shortcut_target to get the target path of a shortcut. It uses the win32com library to create a WScript.Shell object and uses the CreateShortcut method of that object to get the target path of the shortcut.

Then, we define a function called start_program to start the program. It first gets the user input for the quantity of programs to start from the input box and gets the program path from the text box. Then, it calls the open_soft function from the wftools library, passing the program path and quantity as parameters to start the specified number of programs.

Next, we create a Tkinter root window object and set the title, size, and resizable properties of the window.

Then, we create a text box object to display the file paths.

After that, we associate the file drag and drop event with the handle_drag function using the hook_dropfiles function from the windnd library.

Then, we create a label and an entry box for the user to input the quantity of programs to start.

Finally, we create a button to trigger the start_program function.

Lastly, we call root.mainloop() to start the event loop of the program, allowing the GUI interface to respond to user actions.

Usage:

  1. Drag and drop the desktop WeChat icon: Drag and drop the shortcut files of the programs you want to start into the window, and the file paths will be displayed in the text box.

  2. Enter the quantity to start: Enter the number of programs you want to start in the quantity input box. The default is 2. Click "Start" to enable the multi-opening WeChat functionality.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.