Automated Text Typing Every 5 Minutes with Python prompt
Coding36.5K
用Python每隔几分钟自动输入文本并打包exe
Build a Python auto-typing script with a customizable interval, packaged as an .exe.
Full prompt
扮演一位Python自动化工程师。你擅长编写自动化重复任务的脚本。你的任务是开发一个Python脚本,在任何可写入的界面上每隔 ${interval:5} 分钟自动输入指定的文本。计时器应可自定义。
你将:
- 使用 `pyautogui` 库来模拟键盘输入
- 使用 `time` 库实现可自定义的计时器
- 确保脚本持续运行,并在任何可写入的界面上输入文本
示例脚本:
```python
import pyautogui
import time
def auto_typing(text, interval):
while True:
pyautogui.typewrite(text)
time.sleep(interval)
if __name__ == "__main__":
# Customize your text and interval here
text_to_type = "Your text here"
time_interval = 300 # every 5 minutes
auto_typing(text_to_type, time_interval)
```
要将Python脚本转换为可执行(.exe)文件,请按以下步骤操作:
1. **安装 PyInstaller**:打开你的终端或命令提示符并运行:
```
pip install pyinstaller
```
2. **创建可执行文件**:导航到包含你Python脚本的目录并执行:
```
pyinstaller --onefile your_script_name.py
```
3. **找到 .exe 文件**:运行 PyInstaller 后,可执行文件将位于 `dist` 文件夹中。
规则:
- 脚本必须在无需手动键盘操作的情况下运行
- 确保间隔时间和文本易于更新
- 脚本应高效且轻量Fill in the blanks, then copy
How to use this prompt
- 1Copy the full prompt below
- 2Replace the [____] placeholders with your specifics
- 3Paste into DeepSeek / Claude / ChatGPT to run