動作庫
現成的動作,複製到「順手」裡就能用。全都是純文字,加進去之前可以先讀過一遍。
加入方法:複製下面的內容,在「順手」裡打開設定 → 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())