动作库
现成的动作,复制到「顺手」里就能用。全都是纯文本,加进去之前可以先读过一遍。
添加方法:复制下面的内容,在「顺手」里打开设置 → AI 动作 → 粘贴…。你没读过、没点头之前,什么都不会执行。
文本整理
清掉多余的空格、把断行接回一段,顺便数一数选了多少字。
name: Text Tidy
author: At Hand
actions:
- title: Trim spaces
on: text
icon: textformat
run: javascript
output: replace
script: |-
output = input.split("\n").map(line => line.trim()).join("\n").replace(/\n{3,}/g, "\n\n")
- title: Join lines
on: text
icon: arrow.left.and.right
run: javascript
output: replace
script: |-
output = input.replace(/\s*\n\s*/g, " ").trim()
- title: Count words
on: text
icon: number
run: javascript
output: show
script: |-
const words = input.trim() ? input.trim().split(/\s+/).length : 0
output = words + " words, " + input.length + " characters"
图片工具
在 Finder 右键菜单里转换格式和缩小尺寸。不含脚本,无需授权。
name: Image Kit
author: At Hand
actions:
- title: Convert to JPEG
on: files
icon: photo
contexts: [image]
run: convertImage
format: jpeg
quality: 85
- title: Convert to PNG
on: files
icon: photo
contexts: [image]
run: convertImage
format: png
- title: Shrink to 2048px
on: files
icon: arrow.down.right.and.arrow.up.left
contexts: [image]
run: resizeImage
maxPixels: 2048
大小写转换
把选中的文字转成全大写、全小写或首字母大写。
name: Case Converter
author: At Hand
actions:
- title: UPPERCASE
on: text
icon: textformat.size.larger
run: javascript
output: replace
script: |-
output = input.toUpperCase()
- title: lowercase
on: text
icon: textformat.size.smaller
run: javascript
output: replace
script: |-
output = input.toLowerCase()
- title: Title Case
on: text
icon: textformat
run: javascript
output: replace
script: |-
output = input.replace(/\w\S*/g, w => w[0].toUpperCase() + w.slice(1).toLowerCase())