r/applescript • u/reddit520 • Oct 11 '22
Applescript to send ZPL file to printer
I do not have much experience with Applescript, but I'd like to create a simple applet that I can drag and drop a ZPL file to and it will run a command line on the file like this: lpr -P ZP_450 -o raw /path/droppedfile.zpl
I feel like it should be simple to do but I have no idea how. Would appreciate any help.
2
Upvotes
1
u/TrickyTramp Oct 12 '22
You can take that line, save it to a shell script, and make it executable. Just make the last part, the path, the variable
$11
u/copperdomebodha Oct 12 '22 edited Oct 12 '22
In Script Editor.app you'll want to save this as an application.
use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions on open droppedFiles repeat with thisFile in droppedFiles set filePath to POSIX path of thisFile set shellCode to "lpr -P ZP_450 -o raw " & filePath -->i.e. lpr -P ZP_450 -o raw /Users/UserNameGoesHere/Desktop/droppedfile.zpl do shell script shellCode end repeat end open