You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

基于Automator的蓝牙发送文件至HP Sprocket自动化脚本开发问询

解决方案:用AppleScript结合Automator实现蓝牙打印+文件转移

Hey there! Since you're already comfortable with Automator for file transfers, AppleScript is absolutely the right tool here—it integrates seamlessly with Automator and lets you control macOS's Bluetooth file transfer system directly, which is exactly what you need for your HP Sprocket workflow.

Let's walk through how to set this up step by step:

1. Prep: Confirm your HP Sprocket's Bluetooth name

First, make sure your Mac is paired with the Sprocket via Bluetooth, then note its exact device name (you can find this in System Settings → Bluetooth, under your paired devices). You'll need this name for the script.

2. Add the AppleScript action to your Automator workflow

Open your existing Automator workflow (the one that handles file transfers) and insert a "Run AppleScript" action (search for it in the Automator action library) before your file transfer steps. This script will handle sending the image to the Sprocket twice.

Here's a ready-to-use script you can adapt:

on run {input, parameters}
    -- Replace this with your HP Sprocket's exact Bluetooth name
    set sprocketDeviceName to "HP Sprocket 200"
    
    -- Send the image twice to trigger two prints
    repeat with printLoop from 1 to 2
        tell application "System Events"
            -- Send the input file (your new image) to the Sprocket
            send input to device sprocketDeviceName
        end tell
        -- Wait for the transfer to complete (adjust this delay based on your device's speed)
        delay 6
    end repeat
    
    -- Pass the file along to your existing file transfer action
    return input
end run

3. Key Notes & Troubleshooting

  • Adjust the delay time: The delay 6 line gives time for the Bluetooth transfer to finish before sending the second print. If your Sprocket is slow to receive files, bump this up to 8-10 seconds.
  • Ensure Bluetooth is active: Your Mac and Sprocket need to be paired and have Bluetooth turned on for this to work reliably.
  • Test with small files first: Use a low-resolution image to test the workflow before relying on it for larger photos—this will save paper and time!
  • If the send command fails: In rare cases, System Events might not recognize the device name. Try re-pairing the Sprocket, or use the device's Bluetooth MAC address instead (you can get this via system_profiler SPBluetoothDataType in Terminal).

Why AppleScript instead of other tools?

AppleScript is the best fit here because it's built into macOS, integrates natively with Automator, and can directly control system-level actions like Bluetooth file transfers. Other tools (like shell scripts) would require third-party utilities (e.g., blueutil) and be less straightforward to tie into your existing Automator workflow.

内容的提问来源于stack exchange,提问作者Max Kortge

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:37:28