外观
AppleScript 调用
Bob 支持通过脚本调用部分功能。
- 本质上是基于 Open Scripting Architecture (OSA) 实现的
- 脚本代码可以是 AppleScript 和 JavaScript
- 可以使用 Script Editor、osascript command-line tool 等 OSA 组件调用
- 也可通过 Alfred(Workflows - Action - Run Script - usr/bin/osascript)之类的支持 OSA 的第三方 App 进行调用
数据结构
最新的 Bob 脚本调用方式采用 JSON 结构,类似如下结构,path
对应功能模块,body
代表参数信息。
json
{
"path" : "translate",
"body" : {
"text" : "需要翻译的文本",
"inputBoxState" : "alwaysUnfold",
"windowLocation" : "center",
"action" : "translateText"
}
}
可以选择 AppleScript 和 JavaScript 两种语言来调用 Bob。
AppleScript
由于 AppleScript JSON 序列化比较麻烦,抽了一个通用的方法。
- 为了方便调用,创建了一个辅助方法
callBob
,后续编写脚本的时候必须放在 AppleScript 脚本最外层头部 - 调用
callBob
方法时传入的参数代表上述的 JSON 数据 - 调用 Bob 不同的命令,仅需修改调用
callBob
方法的参数即可,其他代码请勿修改
这里以「直接翻译文本」为例,做一下示范。
applescript
-- 以下为通用辅助方法,必须写在脚本最外层头部
use scripting additions
use framework "Foundation"
on callBob(recordValue)
set theParameter to (((current application's NSString)'s alloc)'s initWithData:((current application's NSJSONSerialization)'s dataWithJSONObject:recordValue options:1 |error|:(missing value)) encoding:4) as string
tell application id "com.hezongyidev.Bob" to request theParameter
end callBob
-- 以下为调用 Bob 的参数,仅需修改这部分代码
callBob({|path|:"translate", body:{action:"translateText", |text|:"需要翻译的文本", windowLocation:"center", inputBoxState:"alwaysUnfold"}})
注意
由于头部的辅助方法部分的实现是完全相同的,后续的 AppleScript 调用教程里就不重复写了,AppleScript 调用教程中仅展示调用 callBob
方法及其参数,但实际使用时需要把上述辅助方法相关代码放到 AppleScript 脚本头部。
JavaScript
JavaScript 脚本 JSON 序列化会方便一些,所以以下 JavaScript 演示代码均为完整代码。
翻译功能
翻译功能 path
为 translate
,完整的 body
参数信息如下:
参数名 | 描述 |
---|---|
action | 翻译行为,后续有示例 |
text | 文本;仅 action 为 translateText 类型需赋值 |
imageBase64 | 图片 base64;仅 action 为 translateImage 类型需赋值;开头不要包含「data:image/jpeg;base64,」等文本 |
windowLocation | 翻译窗口位置;string 类型;mouse 为显示在鼠标位置,center 为居中显示,statusIconBottom 为显示在菜单栏图标下方,last 为保持上次位置;该参数可不传,不传代表跟随 Bob App 本身的设置,如无特殊需求,建议不传 |
inputBoxState | 输入框状态;string 类型;last 为保持当前状态,alwaysFold 为总是折叠,alwaysUnfold 为总是展开;该参数可不传,不传代表跟随 Bob App 本身的设置,如无特殊需求,建议不传 |
划词翻译 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"selectionTranslate"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "selectionTranslate",
}
}))
截图翻译 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"snipTranslate"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "snipTranslate",
}
}))
输入翻译 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"inputTranslate"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "inputTranslate",
}
}))
剪贴板翻译 Bob 1.6.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"pasteboardTranslate"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "pasteboardTranslate",
}
}))
显示翻译窗口 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"showWindow"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "showWindow",
}
}))
直接翻译文本 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"translateText", |text|:"需要翻译的文本"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "translateText",
"text": "需要翻译的文本", // 该参数必须传
}
}))
直接翻译图片 Bob 1.5.0+ 可用
applescript
callBob({|path|:"translate", body:{action:"translateImage", imageBase64:"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWFxb/2wBDAQQEBAUFBQoGBgoWDwwPFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhb/wgARCABGAQgDAREAAhEBAxEB/8QAHQABAAMBAQADAQAAAAAAAAAAAAYHCAUEAQIDCf/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAN/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFPCSgApg6xLijDSwAAAAABnstAmgK+LBAABXBlQ0AcM45psyca3MgGxCjyrjWp7D4MzH5k3KgNLGaSSl3lOGgDJ5zzaoAAK4IgVyQYmRsMyIa7MiGuzIZYJOiwQfznPuWoabKOI0X0d0o4sM5BVZr4AAEROIRI45wzVRlMto8ZXhMCrzWp7AZkBaZQJpYrovU8xkM0AZ/JsaPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//xAAuEAACAQQBAgUDAgcAAAAAAAAFBwYBAwQIAgAJEBESExgWIDgXYCMwMjM3OUH/2gAIAQEAAQwA/YrBko6GwctKi9L9cBOTsGzFwOm8bplUF+L72cW6gnHCKSyyc55+uT7gzrul7cNtFeFWvMw68XpOZn6ZPIaJ3jSxApjYFixJ/d/msPclRQyclomYsSOueiGdG23BKS2K8M7gP8Fq4YlOGbKIGF4EaFfu2+/Fqf8AWo072Mva4BgabgAXKFaWvnMcQs4KkwLgDlb/AH/NMVz8E2koriSGWw9/teCN8NBNh4gJGWMwaOy7vu5WBi3+fbn4cOGxb84cKUpwv2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S+ujMme2Xzlg4yDhHK96YsMg4B1QsiaWDZ4vjTkevAgiH6uTjrb68datECSI40UKqj6ADrrW6N29UlmlFp5qyAKVQRlD5I/F9VbVC7eqSzSi1LNVHClUEZQ+SPxfSTpb2+8iZmrOoIBK8jJSrMpGnhFWeZM3sy1vDAn2dXfu9C+ttjOc8nnsysS0khHpyxPd6DXTTdkubelGWR3hQTWn4lzjQA8Tp4Fuq3C0Myf8AdGBBH9idW7ZspBusHMgJAHeprTLlwACVI51usFqpudvbQI4pIJclUJxFHwQh8cNTzu8E92EmeqG8XWNoXwb5Byut9RUqTpLIbcpEpcyTqyABj8mf+p//xAAUEQEAAAAAAAAAAAAAAAAAAACA/9oACAECAQE/ABT/AP/EABQRAQAAAAAAAAAAAAAAAAAAAID/2gAIAQMBAT8AFP8A/9k="}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "translate",
"body": {
"action": "translateImage",
"imageBase64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWFxb/2wBDAQQEBAUFBQoGBgoWDwwPFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhb/wgARCABGAQgDAREAAhEBAxEB/8QAHQABAAMBAQADAQAAAAAAAAAAAAYHCAUEAQIDCf/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAN/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFPCSgApg6xLijDSwAAAAABnstAmgK+LBAABXBlQ0AcM45psyca3MgGxCjyrjWp7D4MzH5k3KgNLGaSSl3lOGgDJ5zzaoAAK4IgVyQYmRsMyIa7MiGuzIZYJOiwQfznPuWoabKOI0X0d0o4sM5BVZr4AAEROIRI45wzVRlMto8ZXhMCrzWp7AZkBaZQJpYrov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fd3ur8RP8A+PV7lTDnwzzva7ej2X19sh1+F6H7CdfTLp1s6Uo/lYsy2Dx+hi1vX+qW2SVYB6R3YpZhwP5Aww6g33Ag+QKIde4bufPhj2D869+28P7R6HSFPur+uibh6BrThI34fMCQFSSOf5Ea9w3f2JNe/Lf+GvcsuuwtfeT8695zfey8/n3raZ6deSyxWJHdCoLlQSB9AdbV7T28tB3eE9palmXEuiHyyD010vneShDVmkM8QMxf4gaNVH6MdSxCDc4L/fWvIFCc+RxyVVQQRweAddG5xYo7PsgIWVsg2LkRoACUTk/xsR1dKJnn3GpukRIEjtm/HwZlcFyWHKgrqZ4TtZ2uBUECgP2mXFeHxOGtrte17bbZM0zxKsjgd+LaqW4fbIuwV556yuM1zNHIsU9S+ujMme2Xzlg4yDhHK96YsMg4B1QsiaWDZ4vjTkevAgiH6uTjrb68datECSI40UKqj6ADrrW6N29UlmlFp5qyAKVQRlD5I/F9VbVC7eqSzSi1LNVHClUEZQ+SPxfSTpb2+8iZmrOoIBK8jJSrMpGnhFWeZM3sy1vDAn2dXfu9C+ttjOc8nnsysS0khHpyxPd6DXTTdkubelGWR3hQTWn4lzjQA8Tp4Fuq3C0Myf8AdGBBH9idW7ZspBusHMgJAHeprTLlwACVI51usFqpudvbQI4pIJclUJxFHwQh8cNTzu8E92EmeqG8XWNoXwb5Byut9RUqTpLIbcpEpcyTqyABj8mf+p//xAAUEQEAAAAAAAAAAAAAAAAAAACA/9oACAECAQE/ABT/AP/EABQRAQAAAAAAAAAAAAAAAAAAAID/2gAIAQMBAT8AFP8A/9k=", // 该参数必须传
}
}))
直接翻译文本老版本 Bob 0.3.0+ 可用
注意,这个方法是早期用于翻译文本的方法,完整的调用代码如下,无需前面所说的那些辅助代码。
applescript
tell application id "com.hezongyidev.Bob"
launch
translate "需要翻译的文本"
end tell
javascript
bob = Application("com.hezongyidev.Bob")
bob.translate("需要翻译的文本")
OCR 功能
OCR 功能 path
为 ocr
,完整的 body
参数信息如下:
参数名 | 描述 |
---|---|
action | OCR 行为,后续有示例 |
imageBase64 | 图片 base64;仅 action 为 ocrImage 类型需赋值;开头不要包含「data:image/jpeg;base64,」等文本 |
isSilent | 是否为静默识别 |
windowLocation | OCR 窗口位置;string 类型;mouse 为显示在鼠标位置,center 为居中显示,statusIconBottom 为显示在菜单栏图标下方,last 为保持上次位置;该参数可不传,不传代表跟随 Bob App 本身的设置,如无特殊需求,建议不传 |
截图 OCR Bob 1.5.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"snipOCR"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "snipOCR",
}
}))
静默截图 OCR Bob 1.5.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"snipOCR", isSilent: true}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "snipOCR",
"isSilent": true,
}
}))
访达选图 OCR Bob 1.5.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"fileOCR"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "fileOCR",
}
}))
剪贴板 OCR Bob 1.6.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"pasteboardOCR"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "pasteboardOCR",
}
}))
显示 OCR 窗口 Bob 1.5.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"showWindow"}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "showWindow",
}
}))
直接 OCR 图片 Bob 1.5.0+ 可用
applescript
callBob({|path|:"ocr", body:{action:"ocrImage", imageBase64:"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWF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f8AdGBBH9idW7ZspBusHMgJAHeprTLlwACVI51usFqpudvbQI4pIJclUJxFHwQh8cNTzu8E92EmeqG8XWNoXwb5Byut9RUqTpLIbcpEpcyTqyABj8mf+p//xAAUEQEAAAAAAAAAAAAAAAAAAACA/9oACAECAQE/ABT/AP/EABQRAQAAAAAAAAAAAAAAAAAAAID/2gAIAQMBAT8AFP8A/9k="}})
javascript
bob = Application("com.hezongyidev.Bob")
bob.request(JSON.stringify({
"path": "ocr",
"body": {
"action": "ocrImage",
"imageBase64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAwOEBQRDg8TDwwMEhgSExUWFxcXDhEZGxkWGhQWFxb/2wBDAQQEBAUFBQoGBgoWDwwPFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhb/wgARCABGAQgDAREAAhEBAxEB/8QAHQABAAMBAQADAQAAAAAAAAAAAAYHCAUEAQIDCf/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAN/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFPCSgApg6xLijDSwAAAAABnstAmgK+LBAABXBlQ0AcM45psyca3MgGxCjyrjWp7D4MzH5k3KgNLGaSSl3lOGgDJ5zzaoAAK4IgVyQYmRsMyIa7MiGuzIZYJOiwQfznPuWoabKOI0X0d0o4sM5BVZr4AAEROIRI45wzVRlMto8ZXhMCrzWp7AZkBaZQJpYrovU8xkM0AZ/JsaPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//xAAuEAACAQQBAgUDAgcAAAAAAAAFBwYBAwQIAgAJEBESExgWIDgXYCMwMjM3OUH/2gAIAQEAAQwA/YrBko6GwctKi9L9cBOTsGzFwOm8bplUF+L72cW6gnHCKSyyc55+uT7gzrul7cNtFeFWvMw68XpOZn6ZPIaJ3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