The script doesn't work after version 8.3.0. If possible could we get an update?
我剛剛用gtp修改 最後成功的
I just used gtp to modify it and finally succeeded.
--------------------------------------------------------
init python:
import inspect
import pygame.scrap
def to_clipboard(event, **kwargs):
if event == "begin":
# Get 'who' and 'what' from kwargs
who = kwargs.get('who', None)
# Default to None
what = kwargs.get('what', 'No text')
# Create the line based on whether 'who' is known
if who:
line = "[%s] %s" % (who, what)
else:
line = what # Only show 'what' if 'who' is unknown
pygame.scrap.init() # Initialize pygame scrap
pygame.scrap.put(pygame.scrap.SCRAP_TEXT, line.encode("utf-8")) # Set clipboard content
config.all_character_callbacks.append(to_clipboard)
--------------------------------------------------------
init python:
import inspect
import pygame.scrap
def to_clipboard(event, **kwargs):
if event == "begin":
who = kwargs.get('who', )
what = kwargs.get('what', )
pygame.scrap.init()
pygame.scrap.put(pygame.scrap.SCRAP_TEXT, what.encode("utf-8"))
config.all_character_callbacks.append(to_clipboard)
--------------------------------------------------------
#Can display 2 segments, such as... Apocalypse Lovers
#可以顯示2段文字,像是 ... 天啟戀人
init python:
import inspect
import pygame.scrap
def to_clipboard(event, **kwargs):
if event == "begin":
# Get 'who' and 'what' from kwargs
who = kwargs.get('who', None)
# Default to None
what = kwargs.get('what', 'No text')
# Check if 'what' contains a newline character
if '\n' in what:
# Count the number of paragraphs (split by newline)
paragraphs = what.split('\n')
# If the number of paragraphs is greater than 2 or 100, do not set clipboard
if len(paragraphs) > 2: # Change this number to 100 if needed
return # Do not set clipboard if there are more than 2 paragraphs
# Create the line based on whether 'who' is known
if who:
line = "[%s] %s" % (who, what)
else:
line = what # Only show 'what' if 'who' is unknown
pygame.scrap.init() # Initialize pygame scrap
pygame.scrap.put(pygame.scrap.SCRAP_TEXT, line.encode("utf-8")) # Set clipboard content
config.all_character_callbacks.append(to_clipboard)
--------------------------------------------------------