I stumbled across Hazel and wondered if there's a way to open html files, then print them in Safari. The code I'm using right now for the folder action script looks like this:
- Code: Select all
# Watch reportFolder for added items.
on adding folder items to thisFolder after receiving newOrderFolders
#say "added"
# Loop on each added item
repeat with i from 1 to number of items in newOrderFolders
try
# Get our orderFolder and orderFolderPath
set orderFolder to item i of newOrderFolders
set orderFolderPath to orderFolder as text
# Get the orderNumber using finder
tell application "Finder"
set orderNumber to name of orderFolder
end tell
# Set jobSheet
set jobSheet to orderFolderPath & orderNumber & "_ACPJobSheet.html"
delay 2
#display alert "Job sheet " & jobSheet
# Open safari and print
tell application "Safari"
activate
open jobSheet
delay 2
print document 1 with properties {copies:1} without print dialog
close (every window whose name is "Aspen Creek Photo Job Sheet")
end tell
on error errText number errNum
display dialog "Error printing order sheet: " & jobSheet & "[" & errNum & return & errText & "]"
end try
#say "done with " & i
end repeat
end adding folder items to
Is this even possible with Hazel? Or, could I just modify my folder action script above and use Hazel to trigger it instead of relying on the Finder? Thanks!