]> snippets.scripts.mit.edu Git - Scripts/git/.git/commitdiff
Instead of looping over the lpr commands within applescript, use a
authorEvan Broder <broder@mit.edu>
Mon, 24 Aug 2009 00:30:42 +0000 (20:30 -0400)
committerEvan Broder <broder@mit.edu>
Mon, 24 Aug 2009 03:13:02 +0000 (23:13 -0400)
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.)

sipbmp3-itunes/INSTALL
sipbmp3-itunes/Send to sipbmp3.applescript

index 52578bac019145f1cccfc08e8caec988c332fad7..06259e37ad6eb94e832ad7d96cfe21b4249f7517 100644 (file)
@@ -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
 
index ebf6e1f4557de9f52bc9c5d1dc0e463aea7c415b..2a0a707171644b1269b8dd7e1b305de8237582f6 100644 (file)
@@ -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
 --
 -- 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 </dev/null &"
+do shell script command