So I wrote a Shell Script.

cp -v `lsof |grep -i QTP| grep iTunes|awk '{ print $9 }'` ~/Desktop/

And then someone else wrote an applescript wrapper.

set originalFile to do shell script "lsof |grep -i QTP| grep iTunes|head -1|awk '{ print $9 }'"
if length of originalFile is greater than 0 then
set newFile to POSIX path of (choose file name with prompt "Save movie as:" default name "iTunes")
if length of newFile is greater than 0 then
if newFile does not end with ".mov" then set newFile to newFile & ".mov"
do shell script "cp -v '" & originalFile & "' '" & newFile & "'"
end if
display dialog "No movie found." buttons {"OK"} default button "OK"
end if

(Just to note this is hardly the only applescript made from my command line thing. It’s just the best one. You can read the full macosxhints thread here.)

I even found mention of it on Doug’s AppleScripts for iTunes. And in case you haven’t figured it out the script copies iTunes Movies (music or trailer) to your desktop.

I’d also like to thank my friend Mike who helped inspire this one afternoon long ago. Before I thought “Hey lets pull this out of the cache!” we tried very many things, some of wich worked. We ended up making a wget command and spoofing the useragent. Ettercap’s http stream grabbing doesn’t work very well – we both concluded on that.


3 thoughts on “Apple Script

  1. Nice script, works well. Would be nicer yet if it worked with filenames that included an apostrophe.

Comments are now closed.