Reputation: 527
I'm relatively new to scripting and using application such as Automator. I would like to try create a script which detects when new images are added to a folder, prints them twice to a device (HP Sprocket) by using the "send file to device" option in Bluetooth, and then moves that image to another folder once the print has been sent (in queue) or completed.
I have used automator to create the transfer of the file, however I have no idea how to go about doing the printing aspect of this. Should I be using applescripts in automator? or another program?
Just for clarification regarding this, this is where the option sits when doing it manually.
The reason I am doing it this way and not just through a standard print is because the HP Sprocket doesn't work as a printer on any devices other than mobile, however you are able to send a file to the device this way with it still printing.
Upvotes: 0
Views: 751
Reputation: 207660
Here are some bits of help:
To detect when files arrive in a folder, you need to Google "Applescript folder actions".
I did something similar to what you are trying and used a folder in Dropbox which allows me to print from a smartphone by dropping files into Dropbox.... neat!
I used a POGO printer in my case, here is the bash
code with embedded Applescript at the end:
################################################################################
# POGOprint
# Send image supplied as parameter to Polaroid POGO printer using Bluetooth
# File Exchange
#
# Mark Setchell
################################################################################
# User editable parameters - get address by clicking Bluetooth icon at top-right
# of the Mac screen and looking for the POGO
# Install ImageMagick using "homebrew", with:
# brew install imagemagick
pogo_address="00-04-48-13-9f-64"
tmp="/tmp/POGO.jpg"
# Get width and height of image using ImageMagick
read w h < <(convert "$1" -format "%w %h" info: )
if [ $w -gt $h ]; then
# Landscape format - wider than tall
convert "$1" -resize 900x600 $tmp
else
# Portrait format - taller than wide
convert "$1" -resize 600x900 $tmp
fi
osascript<<EOF
with timeout of 60 seconds
tell application "Bluetooth File Exchange"
send file "$tmp" as string to device "$pogo_address"
end tell
end timeout
EOF
Upvotes: 1