FasdUAS 1.101.10 k l SkimExtract 0.1.0 l  ke0.1.1 2007-05-21 fix for getting and setting skim notes for pdf without them; prompt for thePDFSuffix  l  0.1.0 2007-04-22  l  original version l  comments to ahm@reed.edu l  Takes the top document in Skim, saves the Skim-related metadata, then uses pdflatex/pdfpages to extract the pages specified of the document. Reopens the resulting PDF, which has a suffix appended to it. l l ~Usage: Open up a PDF in Skim. Select "SkimExtract" from the systemwide script menu. Enter the pages you would like to extract. l l  e_ WARNINGS: This will eliminate the internally-saved metadata in the PDF (TOC, etc.). If you set thePDFSuffix to "" it will overwrite the existing PDF. If you extract anything other than 1-, where is the last page on which you have made annotations, existing annotations will show up on the wrong pages. See the pdfpages manual for pages syntax.!" !l"#$ #l% %{uRequirements: recent (1.3.3+) BibDesk installed in /Applications, latex distribution with pdfpages package installed.$&' &l'() (l* *Installation: Place in ~/Library/Scripts/Applications/Skim/ which you may need to create. Enable the systemwide script menu by opening up Applications/AppleScript/AppleScript Utility and clicking on "Show Script Menu in menu bar".)+, +l,-. -l/0 /j1 0tmpdirtmpDir 1m2 2 /tmp/skim/ 0d^ temporary directory to create (and delete, check directory for errors if script doesn't work).34 3l5 5ZTproperty thePDFSuffix : "-extract" -- suffix to add to PDF (make blank to overwrite)467 6l789 8l : :O ;< ;k==>? >I @A .sysodlogaskrTEXT @mB BOIPages to extract -,-,... where m and n are integers or 'last'AC  dtxt CmD D-?EF Er GH Gl I In JK J1   ttxt Kl L L1  rslt Ho 0thepagesthePagesFMN MIOP .sysodlogaskrTEXT OmQ Q/)Suffix to add to PDFs (blank = overwrite)PR  dtxt RmS S-extractNTU TrVW VlX XnYZ Y1  ttxt Zl[ [1  rslt Wo 0 thepdfsuffix thePDFSuffixU\] \r '^_ ^b %`a `b #bc bm !d dfitpaper=true,pages={ co!" 0thepagesthePages am#$e e} _o &0includepdfoptionsincludePdfOptions]f fQ(gh gk+iijk jl++l l93get the document name, close it, and set the path kmn mr+5op on+1qr q1/1  file r4+/s  docu sm-. po 0thedoctheDocntu tl6>vw vI6>x .coresavenullobj x46:y  docu ym89 w0* make sure that the latest notes are saveduz{ zl?G|} |I?G~ .coreclosnullobj ~4?C  docu mAB }.( no changes while the script is running!{ rHS nHO 1KO  psxp oHK 0thedoctheDoc o 0thepdfthePDF lTT )#set up temp directories and files  QTm lWd IWd .sysoexecTEXTTEXT bW` mWZ mkdir  oZ_ 0tmpdirtmpDir  in case it already exists R .ascrerr ******** rny mnq .pdf n 1tx  txdl 1qt  ascr rz lz nz 4}  citm m oz} 0thepdfthePDF o 0thepdfthePDF r m  n 1  txdl 1  ascr r b o 0tmpdirtmpDir m tmp o 0tmppathtmpPath r b o 0tmppathtmpPath m  input.pdf o 0tmppdftmpPDF I .sysoexecTEXTTEXT b b b m cp ' o 0thepdfthePDF m .pdf'  o 0tmppdftmpPDF r c l b o 0tmppathtmpPath m .tex m  psxf o 0texfiletexFile r I .sysontocTEXTshor m  o 0alfaLF l 4. Set the Latex to parse and write it to tmpDir r c b b b b b b b b b b b b b l m \documentclass{article} o 0alfaLF l m \usepackage{pdfpages} o 0alfaLF l m \begin{document} o 0alfaLF l m  \includepdf[ o &0includepdfoptionsincludePdfOptions m ]{ o 0tmppdftmpPDF m } o 0alfaLF l   m  \end{document} o 0alfaLF m  TEXT o 0thelatextheLatex l <6write the latex, process it, and copy back the results Q k   s/   l*  N* l) I) .rdwropenshorfile o! 0texfiletexFile  perm m$%  boovtrue  o 0filereffileRef  I0= .rdwrwritnull**** o03 0thelatextheLatex  refn o69 0filereffileRef I>E .rdwrclosnull**** o>A 0filereffileRef IF_ .sysoexecTEXTTEXT bF[ bFW !  bFS"# "bFO$% $mFI& & echo "cd  %oIN~ ~0tmpdirtmpDir #mOR' ' ;pdflatex ' !oSV} }0tmppathtmpPath mWZ( ('" | /bin/tcsh)* )Q`+,| +lcz-. -Icz{/z {.sysoexecTEXTTEXT /bcv01 0bcr23 2bcn45 4bcj67 6mcf8 8B? >b@A @bBC BbDE DbFG FbHI HbJK JbLM LmN N mv ' Mor r0tmppathtmpPath KmO O .pdf' ' Ioq q0thepdfthePDF Gop p0 thepdfsuffix thePDFSuffix EmP P .pdf' CmQ Q  ; rm  Aoo o0tmppathtmpPath ?mR R*s<Sn SQTUm TlVW VIlXk l.sysoexecTEXTTEXT XbYZ Yb[\ [b]^ ]b_` _bab abcd cbef ebgh gbij ibkl kbmn mmo oBǓ<藘P֓=<;:9876543210/.-,+*)('&%$#"&'(89:NOPQRoprstu}~ D dtxt C.sysodlogaskrTEXT B rslt A ttxt @0thepagesthePages ?0 thepdfsuffix thePDFSuffix >&0includepdfoptionsincludePdfOptions = docu < file ;0thedoctheDoc :.coresavenullobj 9.coreclosnullobj 8 psxp 70thepdfthePDF 6.sysoexecTEXTTEXT54 3 ascr 2 txdl 1 citm 00tmppathtmpPath /0tmppdftmpPDF . psxf -0texfiletexFile, +.sysontocTEXTshor * 0alfaLF ) TEXT (0thelatextheLatex ' perm &.rdwropenshorfile %0filereffileRef $ refn #.rdwrwritnull**** ".rdwrclosnull****F!l O,EOl O,EO%%EO*k/,E`O*k/j O*k/j O_a,E`Oab%j WXhOa_a,FO_ak/E`Oa_a,FOba%E`O_a %E`!Oa"_%a#%_!%j O_a$%a%&E`&Oa'j (E`)Oa*_)%a+%_)%a,%_)%a-%%a.%_!%a/%_)%a0%_)%a1&E`2O_&a3el 4EQ`5O_2a6_5l 7O_5j 8Oa9b%a:%_%a;%j Oa<_%a=%_%a>%j WXhOa?_%a@%_%%aA%aB%_%aC%j O4aD_%%aE%_%aF%aG%_%aH%_%%aI%j WXhWXaJ_%aK%j OaLb%j WXhWXhUascr ޭ