FasdUAS 1.101.10 k l .( This is a folder listener script that will act as a queue, receiving PDF files from the ScanSnap scanner and feeding them, one by one, to the Abbyy FineReader OCR software. This allows you to keep scanning while the OCR job runs in the background on all of the unprocessed files. Why do we want to do this? The ScanSnap Manager software does not support this by default, so when you scan in a file, it sends it to FineReader for OCR. You then must wait until FineReader finishes its work before scanning in another document. This script allows you to keep scanning without waiting for OCR. Installation: o Copy this script to: /Library/Scripts/Folder Action Scripts You may have to create the "Folder Action Scripts" folder. o Now open a Finder window, control-click and choose: More / Configure Folder Actions... o Check the "Enable Folder Actions" checkbox, if not checked o Click the "+" in the bottom left o Select a folder and click Open o Choose the script "Run OCR on New Folder Items" and click Attach Copyright (C) 2009 Tad Harrison   P This is a folder listener script that will act as a queue, receiving PDF files from the ScanSnap scanner and feeding them, one by one, to the Abbyy FineReader OCR software. This allows you to keep scanning while the OCR job runs in the background on all of the unprocessed files. Why do we want to do this? The ScanSnap Manager software does not support this by default, so when you scan in a file, it sends it to FineReader for OCR. You then must wait until FineReader finishes its work before scanning in another document. This script allows you to keep scanning without waiting for OCR. Installation: o Copy this script to: <home>/Library/Scripts/Folder Action Scripts You may have to create the "Folder Action Scripts" folder. o Now open a Finder window, control-click and choose: More / Configure Folder Actions... o Check the "Enable Folder Actions" checkbox, if not checked o Click the "+" in the bottom left o Select a folder and click Open o Choose the script "Run OCR on New Folder Items" and click Attach Copyright (C) 2009 Tad Harrison  i I .facofgetnullalis o 0 this_folder  flst o 0 added_items QV kC l A; Just in case FineReader is running, wait until it is readyv Just in case FineReader is running, wait until it is ready I 20waitforfinereaderfinishwaitForFineReaderFinish r  m  boovtrue o 0 moreworktodo moreWorkToDo ! V <"# "k7$$%& %r'( 'I) 0 getnextfile getNextFile)* *o 0 this_folder (o 0afileaFile&+ +Z7,-. ,H / /=01 0o 0afileaFile 1m2233 -k#14456 5I#*7 .ascrcmnt******** 7n#&89 81$&  psxp 9o#$ 0afileaFile6: :I+1; 0ocrfileocrFile;< <o,- 0afileaFile .r47=> =m45  boovfals >o 0 moreworktodo moreWorkToDo #o 0 moreworktodo moreWorkToDo!? ?I=C@ 0exitappexitApp@A Am>?BBCC.FineReader for ScanSnap RDE .ascrerr ******** Do 0errorstrerrorStrEF  errn Fo 0errnumerrNum IKVG .sysodlogaskrTEXT GbKRHI HbKPJK JbKNLM LmKLNNOO Error MoLM 0errnumerrNum KmNOPPQQ( while running OCR: IoPQ 0errorstrerrorStr RS RlTU Tpj Name: ocrFile Description: Runs OCR on the next un-OCR'd file Parameters: aFile - the file to be OCR'd UVV Name: ocrFile Description: Runs OCR on the next un-OCR'd file Parameters: aFile - the file to be OCR'd SWX WiYZ YI[ 0ocrfileocrFile[\ \o 0afileaFile Zk]]^_ ^O `a `I b .aevtodocnullalis bo 0afileaFile amcc@alis Macintosh HDWH+FineReader for ScanSnap.app Si ApplicationsU5Macintosh HD:Applications:FineReader for ScanSnap.app8FineReader for ScanSnap.app Macintosh HD(Applications/FineReader for ScanSnap.app/_de dl fg fRL Make sure FineReader actually starts before we start waiting for it to stopghh Make sure FineReader actually starts before we start waiting for it to stopeij iI  00waitforfinereaderstartwaitForFineReaderStartjkl klmn m;5 Now wait 'till it's done so we do one file at a timenooj Now wait 'till it's done so we do one file at a timelp pI 20waitforfinereaderfinishwaitForFineReaderFinishXqr qlst s Name: appIsRunning Description: Determines if a particular application is running. Parameters: appName - the name of the application to be tested Returns: True if the application is running; otherwise False tuu Name: appIsRunning Description: Determines if a particular application is running. Parameters: appName - the name of the application to be tested Returns: True if the application is running; otherwise False rvw vi xy xIz 0 appisrunning appIsRunningz{ {o 0appnameappName yO |} |E ~ ~l n 1  pnam 2  prcs o 0appnameappName }msevsalis Macintosh HDWH+System Events.app n CoreServicesoB. QP:Macintosh HD:System:Library:CoreServices:System Events.app$System Events.app Macintosh HD-System/Library/CoreServices/System Events.app/w l xr Name: exitApp Description: Exits the specified app if it is running. Parameters: appName - the application name  Name: exitApp Description: Exits the specified app if it is running. Parameters: appName - the application name  i  I 0exitappexitApp o 0appnameappName Z I 0 appisrunning appIsRunning o 0appnameappName O  I .aevtquitnullnull 4  capp o 0appnameappName l e_ Name: getNextFile Description: Finds the next unprocessed ScanSnap PDF Return: the file or ""  Name: getNextFile Description: Finds the next unprocessed ScanSnap PDF Return: the file or ""  i I 0 getnextfile getNextFile o 0afolderaFolder k r I .earslfdrutxt@file l  o 0afolderaFolder  lfiv m  boovfals o 0masterfilelistmasterFileList r  n 1  psxp o 0afolderaFolder o 0 posixpath posixPath Y k r$ n" 4"  cobj o ! 0i o 0masterfilelistmasterFileList o 0filenamefileName r%* b%( o%& 0 posixpath posixPath o&' 0filenamefileName o 0 posixfilepath posixFilePath I+0 .ascrcmnt******** o+, 0 posixfilepath posixFilePath l11 l11 5/ Construct a FineReader file name from our file^ Construct a FineReader file name from our file l11 r1> I1< .sysoexecTEXTTEXT b18 b16 l 12 m12filename= n25 135  strq o23~ ~0 posixfilepath posixFilePath m67,; echo ${filename%\.*} o} }0 posixbasename posixBaseName I?F|{ |.ascrcmnt******** l?Bzy b?B m?@ Name: o@Ax x0 posixbasename posixBaseNamezy{ rGL bGJ oGHw w0 posixbasename posixBaseName mHI8 processed by FineReader.pdf ov v$0posixocrfilepathposixOcrFilePath lMMutsuts lMMrr 71 See if the FineReader file we constructed existsb See if the FineReader file we constructed exists lMMqpoqpo OM\ rQ[ IQYnm n.coredoexboolobj 4QUl l file oSTk k$0posixocrfilepathposixOcrFilePathm oj j0 ocrfileexists ocrFileExists mMNsevsalis Macintosh HDWH+System Events.app n CoreServicesoB. QP:Macintosh HD:System:Library:CoreServices:System Events.app$System Events.app Macintosh HD-System/Library/CoreServices/System Events.app/ Z]lih o]^g g0 ocrfileexists ocrFileExists Iahfe f.ascrcmnt******** laddc bad mab    &OCR file found for obcb b0 posixbasename posixBaseNamedceih   Om   rq Iqa` a$0getspotlightinfogetSpotlightInfo`_ _ for muxkMDItemCreator^] ^ from o{|\ \0 posixfilepath posixFilePath] o[ [0 filecreator fileCreator fmn  IZY Z.ascrcmnt******** lXW b mCreator: oV V0 filecreator fileCreatorXWYU Z !TS  F"# "H$ $oR R0 ocrfileexists ocrFileExists #=%& %oQ Q0 filecreator fileCreator &m''(( ScanSnap Manager !L) )4P* P psxf *oO O0 posixfilepath posixFilePathTSU 0i mNN IM+L M.corecnte******** +oK K 0masterfilelistmasterFileListL,J ,L- -m..//J01 0lI23I 2 Name: getSpotlightInfo Description: Gets a named attribute from metadata for a specific file. Parameters: for myattribute - the name of the attribute from myfile - the name of the file Returns: the attribute value or "" if none found 344 Name: getSpotlightInfo Description: Gets a named attribute from metadata for a specific file. Parameters: for myattribute - the name of the attribute from myfile - the name of the file Returns: the attribute value or "" if none found 156 5i78 7IHG9 H$0getspotlightinfogetSpotlightInfoG9F:; F for :oE E0 myattribute;D? >Qw@AB @kjCCDE DrFG FmHHII GoA A(0this_kmditemresultthis_kMDItemResultEJK Jl@?>@?>KL= LOjMN Mk iOOPQ Pr RS Rc TU To < < 0myfile Um ; ; TEXT So: : 0 this_itemQVW VrXY XnZ[ Z19 9 psxp [o8 8 0 this_item Yo7 7 0 this_itemW\] \r^_ ^o6 60 myattribute _o5 50 this_kmditem this_kMDItem]`a `r,bc bn*de d2(*4 4 cwor el(f32 fI(1g0 1.sysoexecTEXTTEXT gb$hi hb jk jblm lmnnoo(/usr/bin/mdls -name mo/ /0 this_kmditem this_kMDItem kmppqq. -raw -nullMarker None in #rs r1!#. . strq so !- - 0 this_item032 co, ,0 theresult theResultatu tI-6+v* +.ascrcmnt******** vc-2wx wb-0yz ym-.{{||Result: zo./) )0 theresult theResult xm01( ( TEXT*u}' }Y7i~&% ~kFd rFP cFN bFL oFG$ $(0this_kmditemresultthis_kMDItemResult nGK 4HK# # cobj oIJ" "0j oGH! !0 theresult theResult mLM  TEXT o (0this_kmditemresultthis_kMDItemResult ZQd AQX oQR 0j nRW mUW  nmbr nRU 2SU  cobj oRS 0 theresult theResult r[` b[^ o[\ (0this_kmditemresultthis_kMDItemResult m\] o (0this_kmditemresultthis_kMDItemResult &0j m:; n;A m>@  nmbr n;> 2<>  cobj o;< 0 theresult theResult%' NmMACSalisr Macintosh HDWH+ Finder.appuFò CoreServicesó3" QP3Macintosh HD:System:Library:CoreServices:Finder.app Finder.app Macintosh HD&System/Library/CoreServices/Finder.app/= AR .ascrerr ******** Brrw mru o (0this_kmditemresultthis_kMDItemResult? Lxz oxy (0this_kmditemresultthis_kMDItemResult 6 l  A; Name: waitForFineReaderFinish Description: Waits until FineReader OCR is complete. Returns: True if FineReader OCR is complete; otherwise False This procedure constantly loops through open FineReader windows looking for the window called "Converting the Document" Once that window goes away, the procedure exits. v Name: waitForFineReaderFinish Description: Waits until FineReader OCR is complete. Returns: True if FineReader OCR is complete; otherwise False This procedure constantly loops through open FineReader windows looking for the window called "Converting the Document" Once that window goes away, the procedure exits.  i I  20waitforfinereaderfinishwaitForFineReaderFinish  kI Z H I 0 appisrunning appIsRunning m.FineReader for ScanSnap L  m   boovfals OF kE r m  boovtrue o 0 window_found WE k @ r * n ( 1&(  pnam n & 2$&  cwin 4 $  pcap m"#.FineReader for ScanSnap o 0ew Z+@ E+. o+, 0ew m,-.Converting the Document k1: r14 m12  boovtrue o 0 window_found I5: .sysodelanullnmbr m56 r=@ m=>  boovfals o 0 window_found H o 0 window_found msevsalis Macintosh HDWH+System Events.app n CoreServicesoB. QP:Macintosh HD:System:Library:CoreServices:System Events.app$System Events.app Macintosh HD-System/Library/CoreServices/System Events.app/ LGI mGH  boovtrue l  Name: waitForFineReaderStart Description: Waits until FineReader OCR has begun. Returns: True if FineReader OCR has started; otherwise False This procedure is used to give FineReader a moment to actually start chewing on a file. It simply waits for the "Converting the Document" window to appear. In order to avoid a permanent loop if FineReader doesn't start, this times out after 30 seconds.  Name: waitForFineReaderStart Description: Waits until FineReader OCR has begun. Returns: True if FineReader OCR has started; otherwise False This procedure is used to give FineReader a moment to actually start chewing on a file. It simply waits for the "Converting the Document" window to appear. In order to avoid a permanent loop if FineReader doesn't start, this times out after 30 seconds.  i I 00waitforfinereaderstartwaitForFineReaderStart kK Z H I 0 appisrunning appIsRunning m.FineReader for ScanSnap L  m  boovfals tH OG kF r m  boovfals o 0 window_found WF k!A     r!+   n!) 1')  pnam n!' 2%'  cwin 4!%  pcap m#$.FineReader for ScanSnap o 0ew  Z,A E,/ o,- 0ew m-..Converting the Document r25 m23  boovtrue o 0 window_found k8A  !" !r8;#$ #m89  boovfals $o 0 window_found"% %I<A& .sysodelanullnmbr &m<=  o 0 window_found m''sevsalis Macintosh HDWH+System Events.app n CoreServicesoB. QP:Macintosh HD:System:Library:CoreServices:System Events.app$System Events.app Macintosh HD-System/Library/CoreServices/System Events.app/ m( (LIK) )mIJ  boovtrue* *l +,-./0123+ .facofgetnullalis 0ocrfileocrFile 0 appisrunning appIsRunning 0exitappexitApp 0 getnextfile getNextFile $0getspotlightinfogetSpotlightInfo 20waitforfinereaderfinishwaitForFineReaderFinish 00waitforfinereaderstartwaitForFineReaderStart, 45 .facofgetnullalis 0 this_folder  flst 0 added_items4 0 this_folder 0 added_items 0 moreworktodo moreWorkToDo 0afileaFile 0errorstrerrorStr 0errnumerrNum5 2B6NP 20waitforfinereaderfinishwaitForFineReaderFinish 0 getnextfile getNextFile  psxp .ascrcmnt******** 0ocrfileocrFile 0exitappexitApp 0errorstrerrorStr6  errn 0errnumerrNum .sysodlogaskrTEXTWE*j+OeEO.h*k+EO ,j O*k+YfE[OYO*k+WX %%%j -Z78 0ocrfileocrFile99 0afileaFile7 0afileaFile8c .aevtodocnullalis 00waitforfinereaderstartwaitForFineReaderStart 20waitforfinereaderfinishwaitForFineReaderFinishj UO*j+O*j+.y:; 0 appisrunning appIsRunning<< 0appnameappName: 0appnameappName;  prcs  pnam  *-,U/=> 0exitappexitApp?? 0appnameappName= 0appnameappName> 0 appisrunning appIsRunning  capp .aevtquitnullnull*k+*/*j UYh0@A 0 getnextfile getNextFileBB 0afolderaFolder@ ~}|{ 0afolderaFolder 0masterfilelistmasterFileList 0 posixpath posixPath 0i 0filenamefileName 0 posixfilepath posixFilePath ~0 posixbasename posixBaseName }$0posixocrfilepathposixOcrFilePath |0 ocrfileexists ocrFileExists {0 filecreator fileCreatorAzyxwvutsrq ponm'lk. z lfiv y.earslfdrutxt@file x psxp w.corecnte******** v cobj u.ascrcmnt******** t strq s.sysoexecTEXTTEXT r file q.coredoexboolobj p for o fromn m$0getspotlightinfogetSpotlightInfo l bool k psxffl EO,EOkj kh/EO%EOj O,%%j EO%j O%EO */j EUO %j YhO)*aaaa EUOa%j O aa& *a/EYh[OYkOa1j8ihCDg j$0getspotlightinfogetSpotlightInfoihfeE f for e0 myattributeEdcb d from c 0myfilebCa`_^]\[ a0 myattribute ` 0myfile _(0this_kmditemresultthis_kMDItemResult ^ 0 this_item ]0 this_kmditem this_kMDItem \0 theresult theResult [0jDHZYnpXWV{UTSRQ Z TEXT Y psxp X strq W.sysoexecTEXTTEXT V cwor U.ascrcmnt******** T cobj S nmbrRQg{lEO`&EO,EOEO%%,%j -EO%&j O1k-,Ekh/%&EO-, %EYh[OYUW XaEO2PONFGM P20waitforfinereaderfinishwaitForFineReaderFinishONFLK L0 window_found K0ewG JIHGF J0 appisrunning appIsRunning I pcap H cwin G pnam F.sysodelanullnmbrMJ*k+ fYhO2eEO+h */-,EOeEOkj YfE[OYUOe3EDCHIB E00waitforfinereaderstartwaitForFineReaderStartDCHA@ A0 window_found @0ewI ?>'=<;: ?0 appisrunning appIsRunning> = pcap < cwin ; pnam :.sysodelanullnmbrBL*k+ fYhOn1fEO*h*/-,EOeEY fEOkj [OYUoOeascr ޭ