From: Evan Broder Date: Mon, 24 Aug 2009 00:30:42 +0000 (-0400) Subject: Instead of looping over the lpr commands within applescript, use a X-Git-Url: https://sipb.mit.edu/gitweb.cgi/snippets/.git/commitdiff_plain/afc9e7df6930d2808a7152141dc4fcd5198f4ced Instead of looping over the lpr commands within applescript, use a backgrounded shell loop so that iTunes doesn't hang while the jobs are printing. (Since I'm not currently on campus, this is as yet untested.) --- diff --git a/sipbmp3-itunes/INSTALL b/sipbmp3-itunes/INSTALL index 52578ba..06259e3 100644 --- a/sipbmp3-itunes/INSTALL +++ b/sipbmp3-itunes/INSTALL @@ -6,6 +6,8 @@ music from an iTunes library to the sipbmp3 lpr server. * Changelog +23 Aug 2009 -> broder spun loop into shell script instead of + applescript so that iTunes doesn't hang 9 Jan 2009 -> price added 'quoted form' 7 Jan 2009 -> kmill created initial version diff --git a/sipbmp3-itunes/Send to sipbmp3.applescript b/sipbmp3-itunes/Send to sipbmp3.applescript index ebf6e1f..2a0a707 100644 --- a/sipbmp3-itunes/Send to sipbmp3.applescript +++ b/sipbmp3-itunes/Send to sipbmp3.applescript @@ -7,6 +7,8 @@ -- -- Changelog: -- +-- 23 Aug 2009 -> broder spun loop into shell script instead of +-- applescript so that iTunes doesn't hang -- 9 Jan 2009 -> price added 'quoted form' -- 7 Jan 2009 -> kmill created initial version -- @@ -33,17 +35,16 @@ -- feedback beyond the pleasant sounds you now -- hear around you. -set lista to {} +set ts to "" tell application "iTunes" repeat with t in selection if class of t is (file track) then set loc to POSIX path of (get location of t) - set end of lista to "lpr -o raw -Psipbmp3 " & (quoted form of loc) + set ts to ts & " " & (quoted form of loc) end if end repeat end tell -repeat with com in lista - do shell script com -end repeat \ No newline at end of file +set command to "(for t in " & ts & "; do lpr -o raw -Psipbmp3 \"$t\"; done) >/dev/null 2>&1