Slack Print Skill
Strict rules:
- - Do not use write/edit tools to create or modify any files
- Do not create Python scripts, test scripts, or any auxiliary files
- Only run existing shell scripts or
lp commands via exec
Print Files from Slack
Smart Matching: Interpret Intent → Set Variables → Call Script
| User says | Environment variables |
|---|
| "Print the latest file" / "Print this file" | (default, no variables needed) |
| "Print the last two files" / "Print these two files" |
LIMIT=2 |
| "Print files starting with report" |
NAME_PREFIX=report |
| "Print files with contract in the name" |
NAME_CONTAINS=contract |
| "Print the PDF I just uploaded" / "Print the PDF from just now" |
MINUTES=5 FILE_TYPE=pdf |
| "Print the last three files" |
LIMIT=3 MINUTES=10 |
FILE_TYPE values: pdf / image / video / doc / file (default — matches all)
Invocation
CODEBLOCK0
Script prints Sent to printer: <filename> for each file on success.
Print Text Content Directly
CODEBLOCK1
Multi-line content:
cat > /tmp/openclaw_print.txt << 'EOF'
content
EOF
lp -d <PrinterName> /tmp/openclaw_print.txt
List Available Printers
CODEBLOCK3
Check Print Queue
CODEBLOCK4
Cancel Print Jobs
CODEBLOCK5
Check Printer Status
CODEBLOCK6
Slack 打印技能
严格规则:
- - 不得使用写入/编辑工具创建或修改任何文件
- 不得创建 Python 脚本、测试脚本或任何辅助文件
- 只能通过 exec 运行现有的 shell 脚本或 lp 命令
从 Slack 打印文件
智能匹配:解读意图 → 设置变量 → 调用脚本
| 用户表述 | 环境变量 |
|---|
| 打印最新文件 / 打印这个文件 | (默认,无需变量) |
| 打印最后两个文件 / 打印这两个文件 |
LIMIT=2 |
| 打印以 report 开头的文件 | NAME_PREFIX=report |
| 打印名称中包含 contract 的文件 | NAME_CONTAINS=contract |
| 打印我刚上传的 PDF / 打印刚才的 PDF | MINUTES=5 FILE_TYPE=pdf |
| 打印最后三个文件 | LIMIT=3 MINUTES=10 |
FILE_TYPE 取值:pdf / image / video / doc / file(默认 — 匹配所有类型)
调用方式
bash
默认:打印最新文件
PRINTER=MyPrinter
DIR>/slackfetchandprint.sh
打印最新的 2 个文件
PRINTER=MyPrinter LIMIT=2 DIR>/slackfetchandprint.sh
打印名称以 report 开头的文件
PRINTER=MyPrinter NAMEPREFIX=report DIR>/slackfetchand_print.sh
打印过去 5 分钟内上传的 PDF 文件
PRINTER=MyPrinter MINUTES=5 FILETYPE=pdf DIR>/slackfetchand_print.sh
脚本成功执行后会为每个文件输出:Sent to printer:
直接打印文本内容
bash
echo 要打印的内容 | lp -d <打印机名称>
多行内容:
bash
cat > /tmp/openclaw_print.txt << EOF
内容
EOF
lp -d <打印机名称> /tmp/openclaw_print.txt
列出可用打印机
bash
lpstat -a
查看打印队列
bash
lpq -P <打印机名称>
取消打印任务
bash
cancel -a <打印机名称>
检查打印机状态
bash
lpstat -p <打印机名称>