FasdUAS 1.101.10 k l  Populate Template Placeholders This script populates a copy of a template by replacing placeholders with text. by Curt Clifton Copyright 2007, Curtis Clifton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Version History: 0.5.2 updated for OmniFocus AppleScript implementation change 0.5.1 updated for OmniFocus AppleScript dictionary change 0.5, added Growl notifications, better error checking, bug fix in date handling, work around for OF multiple-window bug, and replacement of placeholders in notes 0.4, automatically duplicates the project, works with content pane or sidebar selection 0.3, now works for subprojects 0.2, clears placeholders from note of project 0.1, initial release, 6/13/07   D Populate Template Placeholders This script populates a copy of a template by replacing placeholders with text. by Curt Clifton Copyright 2007, Curtis Clifton All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: " Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. " Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Version History: 0.5.2 updated for OmniFocus AppleScript implementation change 0.5.1 updated for OmniFocus AppleScript dictionary change 0.5, added Growl notifications, better error checking, bug fix in date handling, work around for OF multiple-window bug, and replacement of placeholders in notes 0.4, automatically duplicates the project, works with content pane or sidebar selection 0.3, now works for subprojects 0.2, clears placeholders from note of project 0.1, initial release, 6/13/07  l  WQ Activate, Relocate New Template Addon by Rebecca O'Connell (except where noted)   Activate, Relocate New Template Addon by Rebecca O'Connell (except where noted)   j &0placeholderopenerplaceholderOpener m j &0placeholdercloserplaceholderCloser m l l MG The following properties are used for script notification via Growl.  The following properties are used for script notification via Growl.  ! j" 0 growlappname growlAppName "m##$$Curt's Scripts!%& %j ' 20scriptstartnotificationscriptStartNotification 'm (())Script Began&*+ *j , 40scriptfinishnotificationscriptFinishNotification ,m --.. Script Completed+/0 /j1 ,0defaultnotificationsdefaultNotifications 1J223 3o 40scriptfinishnotificationscriptFinishNotification045 4j6 $0allnotificationsallNotifications 6b78 7o ,0defaultnotificationsdefaultNotifications 8J99: :o 20scriptstartnotificationscriptStartNotification5;< ;j= 00iconloaningapplicationiconLoaningApplication =m>>??OmniFocus.app<@A @lABC BlD DOEF EkGGHI HOJK Jk LLMN MO 0OP Ol/QRS Qk/TTUV UrWX WnYZ Y2  OTst Z1  FCcn Xo $0theselecteditemstheSelectedItemsV[ [Z/\] \l!^ ^>!_` _la aIb .corecnte******** bo $0theselecteditemstheSelectedItems `m  ]k$+ccde dl$$fg f try sidebar selectionghh, try sidebar selectionei ir$+jk jn$)lm l2')  OTst m1$'  FCSt ko $0theselecteditemstheSelectedItems R/) (first document window whose index is 1)SnnR (first document window whose index is 1) P4 o  FCdw om Npq pZ1Krs rl18t tA18uv ul16w wI16x .corecnte******** xo12 $0theselecteditemstheSelectedItems vm67 sk;Gyyz{ zI;D|} .sysodisAaleRTEXT |m;<~~\You must first select the project to populate.}  mesS m=>jSelect a project that includes template placeholders.  as A m?@  EAlTwarN{ LEGq ZLh lLS ?LS lLQ ILQ .corecnte******** oLM $0theselecteditemstheSelectedItems mQR kVd IVa .sysodisAaleRTEXT mVWBYou must select just one project.  mesS mX[Select a single project that includes template placeholders, but don t select the actions and subprojects under it.  as A m\]  EAlTwarN Lbd lii riw nis 1os  valL nio 4jo  cobj mmn oij $0theselecteditemstheSelectedItems o 0 selecteditem selectedItem rx nx 1{  pnam ox{ 0 selecteditem selectedItem o 0theprojectnametheProjectName r n 1  FCno o 0 selecteditem selectedItem o 0thenotetheNote r J o "0theplaceholdersthePlaceholders Q k r n 4  cpar m o 0thenotetheNote o ,0theplaceholderstringthePlaceholderString r n I 00parseplaceholderstringparsePlaceholderString o ,0theplaceholderstringthePlaceholderString f o "0theplaceholdersthePlaceholders R .ascrerr ******** Z l = l I .corecnte******** o "0theplaceholdersthePlaceholders m k I .sysodisAaleRTEXT b b mThis project,  o 0theprojectnametheProjectName m , does not appear to contain a list of placeholders at the end of its note field.  mesS b b b b b b b b mThe note of a project should end with a list of project placeholders, like: o  ret o &0placeholderopenerplaceholderOpener mRoomName o &0placeholdercloserplaceholderCloser m o &0placeholderopenerplaceholderOpener mClientName o &0placeholdercloserplaceholderCloser  as A m~ ~ EAlTwarN} } btns J | mOK|{z { dflt m yyzx Lwwx r' n# 1#v v FCDs  ou u0 selecteditem selectedItem ot t0 thestartdate theStartDate   r(3   n(/ 1+/s s FCDd o(+r r0 selecteditem selectedItem  oq q0 theduedate theDueDate  l44ponpon I4Om m.coreclon******** l4>lk n4> 1:>j j valL n4: 45:i i cobj m89hh o45g g$0theselecteditemstheSelectedItemslkfe f insh nAK 9GKd d insl 4AGc c FCSX mEFbbe !  rPZ"# "4PVa$ a FCSX $mTU`` #o_ _ 0duplicateditemduplicatedItem!%& %l[[^'(^ 'uo -- Experimental code to select the duplicate tell sidebar of document window 1 to select duplicatedItem ()) -- Experimental code to select the duplicate tell sidebar of document window 1 to select duplicatedItem &*+ *r[i,- ,n[e./ .I\e]0\ ]"0getreplacementsgetReplacements012 1o\_[ ["0theplaceholdersthePlaceholders23Z 3J_aYYZ\ /f[\ -oX X"0thereplacementstheReplacements+45 4lj|678 6Zj|9:WV 9ljs;UT ;=js<= <ljq>SR >IjqQ?P Q.corecnte******** ?ojmO O"0thereplacementstheReplacementsPSR =mqrNNUT :LvxMMWV 7 cancelled8@@ cancelled5AB AZ}CDEF Cl}GLK G>}HI Ho}J J0 theduedate theDueDate ImI I msngLK DkJJKL KrMN MnOP OIHQG H*0getdatedifferentialgetDateDifferentialQRS RmTTUUdueSVF VoE E0 theduedate theDueDateFG Pf NoD D$0datedifferentialdateDifferentialLWC WZXYBA XlZ@? Z=[\ [o> >$0datedifferentialdateDifferential \m= = msng@? YL<<BACE]^ ]l_;: _>`a `o9 90 thestartdate theStartDate am8 8 msng;:^b7 bkccde drfg fnhi hI6j5 6*0getdatedifferentialgetDateDifferentialjkl kmmmnn startlo4 oo3 30 thestartdate theStartDate45 if go2 2$0datedifferentialdateDifferentialep1 pZqr0/ qls.- s=tu to, ,$0datedifferentialdateDifferential um+ + msng.- rL**0/17 Frvw vm) ) msng wo( ($0datedifferentialdateDifferentialBxy xnz{ zI'|& ' 0notify|}~ }m&Populating Template~ b b mZDuplicating and populating the template for  o% % 0theprojectnametheProjectName m $ o# #20scriptstartnotificationscriptStartNotification$& {fy l"! "!  Q3 r  J l e n 1  FCrt o  0duplicateditemduplicatedItem o 0thetasktheTask R .ascrerr ******** o 0msg  errn o 0num Z3 = o 0num m\ r" J o  0duplicateditemduplicatedItem o 0thetasktheTask k%3 I%* .sysobeepnulllong   R+3  .ascrerr ******** o12 0msg  errn o/0 0num  r4F n4B I5B 00buildreplacementscriptbuildReplacementScript o58 "0theplaceholdersthePlaceholders o8; "0thereplacementstheReplacements m;> f45 o 0 thecommand theCommand nGU IHU *0replaceplaceholdersreplacePlaceholders oHK 0thetasktheTask oKN 0 thecommand theCommand oNQ $0datedifferentialdateDifferential fGH rVe lVa IVa &0stripplaceholdersstripPlaceholders fVW  from oZ] 0thenotetheNote o 0thenotetheNote rfu lfq nfq Igq 0 replacetext replaceText ogj 0thenotetheNote ojm 0 thecommand theCommand ffg o 0thenotetheNote rv ovy 0thenotetheNote n 1|  FCno oy| 0duplicateditemduplicatedItem K4  docu mI l l l l l A;Begin Activate, Relocate New Template updated notification vBegin Activate, Relocate New Template updated notification  l my notify("Template Populated", "The project template has been populated. Youll find it at the end of the project listing.", scriptFinishNotification)0my notify("Template Populated", "The project template has been populated. You ll find it at the end of the project listing.", scriptFinishNotification) n I 0notify m$Template Populated mXThe project template has been populated. If you specified a location path, your file is being moved there now. Otherwise, you ll find it at the end of the project listing. o 40scriptfinishnotificationscriptFinishNotification f l l l FmOFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/C l l    4. Begin Activate, Relocate New Template Script    \ Begin Activate, Relocate New Template Script    l  j  60locationplaceholderopenerlocationPlaceholderOpener m{ j!% 60locationplaceholdercloserlocationPlaceholderCloser m!$} l l= O= O< k;!!"# "l$% $NHreturn first section whose name is "Vision:Faculty Research & Resources"%&&return first section whose name is "Vision:Faculty Research & Resources"#'( 'l)* )<6set treePath to " Vision:Faculty Research & Resources"*++lset treePath to " Vision:Faculty Research & Resources"(,- ,l-./ .r01 042  FCSX 2m 1o 0 newtemplate newTemplate/34 3l456 5r78 7m  FCPsFCPa 8n9: 91  FCPs :o 0 newtemplate newTemplate6;< ;r=> =n?@ ?1  FCno @o 0 newtemplate newTemplate >o 0notestrnoteStr<AB AlCD C+%return count of paragraphs of noteStrDEEJreturn count of paragraphs of noteStrBFG FQHIJ HkKKLM LrNO NnPQ P4R  cpar Rm Qo 0notestrnoteStr Oo 0notestrnoteStrMS SrTU TnVW VIX @0parselocationplaceholderstringparseLocationPlaceholderStringXY Yo 0notestrnoteStr Wf Uo 0treepathtreePath IR .ascrerr ******** JrZ[ ZJ [o 0treepathtreePathG\ \Z;]^ ]l_ _>`a `lb bIc .corecnte******** co 0treepathtreePath am ^k7ddef ergh gnij i4k  cobj km jo 0treepathtreePath ho 0treepathtreePathflm lr no nn pq pI r $0getspecifiedtreegetSpecifiedTreers so  0treepathtreePath qf  oo 0 foundpath foundPathmtu tluv vZ7wxy w>z{ zo 0 foundpath foundPath {m  boovfals xr-|} |n)~ ~I)~} ~0 movetosection moveToSection o"| |0treepathtreePath{ o"%z z0 newtemplate newTemplate{} f }oy y0 movedtemplate movedTemplate yI07xw x.sysodlogaskrTEXT m03The location path you provided is not valid. The template was left at the bottom of the end of the project listing.w  4v v docu muu mOFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/ ltsrtsr lqpoqpo lnn 82 Begin Populate Template Placeholders Subroutines d Begin Populate Template Placeholders Subroutines  lmlkmlk i&) Iji j00parseplaceholderstringparsePlaceholderStringh og g0 thestring theStringhi k5 r n 1f f txdl 1e e ascr od d0olddelimoldDelim r o c c&0placeholderopenerplaceholderOpener n 1 b b txdl 1 a a ascr r n 1` ` rest n 2_ _ citm o^ ^0 thestring theString o] ]0 firstparse firstParse r! o\ \&0placeholdercloserplaceholderCloser n 1 [ [ txdl 1Z Z ascr r", I"*YX Y&0cleanplaceholderscleanPlaceholders o#$W W0 firstparse firstParseV J$&UUVX oT T0 theresult theResult r-2 o-.S S0olddelimoldDelim n 1/1R R txdl 1./Q Q ascrP L35 o34O O0 theresult theResultP lNMLNML lKK SM assumes that AppleScript's text item delimiters is set to placeholderCloser  assumes that AppleScript's text item delimiters is set to placeholderCloser  i*- IJI J&0cleanplaceholderscleanPlaceholders oH H0thelisttheListG oF F 0accumGI k; Z ED lCB = oA A0thelisttheList J@@CB L  o? ? 0accumED r n 4> > cobj m== o< <0thelisttheList o; ;0 firstitem firstItem r n 4: : citm m99 o8 80 firstitem firstItem o7 70 firstitem firstItem Z065 l%43 >% l#21 I#0/ 0.corecnte******** n 2. . cha o- -0 firstitem firstItem/21 m#$,,43 r(, o()+ +0 firstitem firstItem n ;*+ o)** * 0accum65) L1; I1:(' (&0cleanplaceholderscleanPlaceholders n25 135& & rest o23% %0thelisttheList$ o56# # 0accum$') l"! "!  i.1 I "0getreplacementsgetReplacements   o "0theplaceholdersthePlaceholders    o  0accum kG     Z  l = o "0theplaceholdersthePlaceholders J L  o  0accum r n 4  cobj m o "0theplaceholdersthePlaceholders o  0theplaceholderthePlaceholder Q5 O*!" !r)#$ #I'%& .sysodlogaskrTEXT %b'( 'o  0theplaceholderthePlaceholder (m))**:& +,  dtxt +m !--.., /  appr /m"#0011BEnter replacement for placeholder $o 0reply "m22OFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/ R  .ascrerr ********  L253 3J2445 4r6<67 6l698 8n699: 9179  ttxt :o67  0reply 7n;< ;;:; <o9:  0accum5= =L=G> >I=F? "0getreplacementsgetReplacements?@A @n>ABC B1?A  rest Co>? "0theplaceholdersthePlaceholdersAD DoAB 0accumEF ElFGH Gi25IJ IIK *0getdatedifferentialgetDateDifferentialKLM Lo 0datekinddateKindMN No 0 originaldate originalDate JkeOOPQ PrRS Rm  boovfals So 0 validinput validInputQTU TrVW VmXXYY Wo 0 theanswer theAnswerUZ[ ZW`\] \k[^^_` _O"ab ar!cd cIef .sysodlogaskrTEXT elg gbhi hbjk jmllmm Enter ko 0datekinddateKind imnnoo" date for projectfpq  dtxt po 0 theanswer theAnswerqr  appr rmssttEnter Date do 0thereplytheReply bmuuOFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/`vw vQ#5xyz xr&+{| {n&)}~ }1')  ttxt ~o&' 0thereplytheReply |o 0 theanswer theAnswer yR .ascrerr ******** zk35 l33  user cancelled user cancelled L35 m34  msngw Q6L k9C r9? 49=  ldt o;< 0 theanswer theAnswer o 0newdatenewDate r@C m@A  boovtrue o 0 validinput validInput R .ascrerr ******** lKK " probably a conversion error8 probably a conversion error ZM[ lMO HMO oMN 0 validinput validInput IRW .sysobeepnulllong ]o 0 validinput validInput[ Lae lad \ad oab 0newdatenewDate obc 0 originaldate originalDateH l i69 I 00buildreplacementscriptbuildReplacementScript o "0theplaceholdersthePlaceholders o "0thereplacementstheReplacements o 0accum kG Z  l = o "0theplaceholdersthePlaceholders J L  o 0accum r n 4  cobj m o "0theplaceholdersthePlaceholders o 0oldtextoldText r n 4  cobj m o "0thereplacementstheReplacements o 0newtextnewText r3 b1 b/ b- b+ b% b# m | sed 's| o" &0placeholderopenerplaceholderOpener o#$ 0oldtextoldText o%* &0placeholdercloserplaceholderCloser m+,| o-. 0newtextnewText m/0|g' o 0 commandpart commandPart r49 b47 o45 0accum o56 0 commandpart commandPart o 0accum L:G I:F 00buildreplacementscriptbuildReplacementScript n;> 1<>  rest o;< "0theplaceholdersthePlaceholders n>A 1?A  rest o>? "0thereplacementstheReplacements oAB 0accum l i:= I *0replaceplaceholdersreplacePlaceholders o 0thetaskstheTasks o 0 thecommand theCommand o $0datedifferentialdateDifferential k$ Z  l = o 0thetaskstheTasks J L  I >0replaceplaceholdersinchildrenreplacePlaceholdersInChildren n 4  cobj m o 0thetaskstheTasks   o 0 thecommand theCommand   o $0datedifferentialdateDifferential  I$ *0replaceplaceholdersreplacePlaceholders  n 1  rest o~ ~0thetaskstheTasks o} }0 thecommand theCommand| o { {$0datedifferentialdateDifferential| lzyxzyx i>A Iwv w>0replaceplaceholdersinchildrenreplacePlaceholdersInChildren ou u0thetasktheTask ot t0 thecommand theCommand s  or r$0datedifferentialdateDifferentialsv wT!" !kT##$% $r&' &l (qp (n )* )I o+n o0 replacetext replaceText+,- ,c./ .n01 01m m pnam 1ol l0thetasktheTask /mk k TEXT-2j 2o i i0 thecommand theCommandjn *fqp 'n34 31h h pnam 4o g g0thetasktheTask%56 5r78 7l9fe 9n:; :Id =n?@ ?1b b FCDd @oa a0thetasktheTask>A` Ao_ _$0datedifferentialdateDifferential`c ;ffe 8nBC B1^ ^ FCDd Co] ]0thetasktheTask6DE Dr -FG Fl )H\[ Hn )IJ II!)ZKY Z0 updatedate updateDateKLM Ln!$NO N1"$X X FCDs Oo!"W W0thetasktheTaskMPV Po$%U U$0datedifferentialdateDifferentialVY Jf !\[ GnQR Q1*,T T FCDs Ro)*S S0thetasktheTaskEST SZ.IUVRQ Ul.3WPO W>.3XY Xn.1Z[ Z1/1N N FCno [o./M M0thetasktheTask Ym12L L msngPO Vr6E\] \l6A^KJ ^n6A_` _I7AIaH I0 replacetext replaceTextabc bc7<de dn7:fg f18:G G FCno go78F F0thetasktheTask em:;E E TEXTchD ho<=C C0 thecommand theCommandDH `f67KJ ]nij i1BDB B FCno joABA A0thetasktheTaskRQTk@ knJTlm lIKT?n> ?*0replaceplaceholdersreplacePlaceholdersnop onKNqr q2LN= = FCac roKL< <0thetasktheTaskpst soNO; ;0 thecommand theCommandtu: uoOP9 9$0datedifferentialdateDifferential:> mfJK@"OFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/vw vl876876wxy xiBEz{ zI5|4 50 replacetext replaceText|}~ }o3 30thetexttheText~2 o1 10 thecommand theCommand24 {k r n 10 0 strq o/ /0thetexttheText o. .0 quotedtext quotedText r I-, -.sysoexecTEXTTEXT b  b  m echo o+ +0 quotedtext quotedText o * *0 thecommand theCommand, o) )0 quotedtext quotedText( L o' '0 quotedtext quotedText(y l&%$&%$ iFI I#" #0 updatedate updateDate o! !0 originaldate originalDate o $0datedifferentialdateDifferential " k Z l  G  = o 0 originaldate originalDate m  msng =  o $0datedifferentialdateDifferential m  msng L m  msng r [ o 0 originaldate originalDate o $0datedifferentialdateDifferential o 0newdatenewDate L o 0newdatenewDate l iJM I  &0stripplaceholdersstripPlaceholders    from o 0thenotetheNote k% Z l  =  l I .corecnte******** n 2  cpar o 0thenotetheNote m L  m  r" n  7   ctxt 4  cpar m 4  cpar m o 0thenotetheNote o 0 noteparts noteParts L#% o#$ 0 noteparts noteParts l l l   Uses Growl to display a notification message. theTitle a string giving the notification title theDescription a string describing the notification event theNotificationKind a string giving the notification kind (must be an element of allNotifications)  Uses Growl to display a notification message. theTitle  a string giving the notification title theDescription  a string describing the notification event theNotificationKind  a string giving the notification kind (must be an element of allNotifications)  iNQ I 0notify o 0thetitletheTitle o 0thedescriptiontheDescription o *0thenotificationkindtheNotificationKind O4 k3 I! .registernullnull  appl o 0 growlappname growlAppName  anot o  $0allnotificationsallNotifications  dnot o ,0defaultnotificationsdefaultNotifications  iapp o 00iconloaningapplicationiconLoaningApplication I"3 .notifygrnullnull  name o$% *0thenotificationkindtheNotificationKind  titl o&' 0thetitletheTitle  appl o(- 0 growlappname growlAppName  desc o./ 0thedescriptiontheDescription m@GRRRalisHD~(H+cGrowlHelperApp.appU Resources~nUNcbas|cg^HD:Users:rloconne:Library:PreferencePanes:Growl.prefPane:Contents:Resources:GrowlHelperApp.app&GrowlHelperApp.appHD[Users/rloconne/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/ l l l l  4. Activate, Relocate New Template Subroutines    \ Activate, Relocate New Template Subroutines    l    iRU I @0parselocationplaceholderstringparseLocationPlaceholderString o 0 thestring theString k5 r n 1  txdl 1  ascr o 0olddelimoldDelim r o 60locationplaceholderopenerlocationPlaceholderOpener n 1   txdl 1  ascr !  r"# "n$% $1  rest %n&' &2  citm 'o 0 thestring theString #o 0 firstparse firstParse!() (r!*+ *o 60locationplaceholdercloserlocationPlaceholderCloser +n,- ,1  txdl -1  ascr)./ .r",01 0I"*2 &0cleanplaceholderscleanPlaceholders234 3o#$ 0 firstparse firstParse45 5J$& 1o 0 theresult theResult/67 6r-289 8o-. 0olddelimoldDelim 9n:; :1/1  txdl ;1./  ascr7< <L35= =o34 0 theresult theResult>? >l?@A @lABC BlCDE DiVYFG FIH $0getspecifiedtreegetSpecifiedTreeHI Io 0treepathtreePath GOgJK JkfLLMN MOcOP OO bQR QkaSSTU Tr#VW V6!XY XnZ[ Z4\  OTtr \m [1  FCSt Y= ]^ ]1  pnam ^m__``Library Wo 0 currenttree currentTreeUab al$$bcd cr$,ef en$*gh gI%*i 0 getpathparts getPathPartsij jo%& 0treepathtreePath hf$% fo 0 treepathparts treePathPartsdkl kl--lm mY-anop nQ;\qrs qr>Ptu tl>Nv v6>Nwx wn>Byz y4?B{  OTtr {m@A zo>? 0 currenttree currentTree x=CM|} |1DF  pnam }lGL~ ~nGL 4IL  cobj oJK~ ~0i oGI} }0 treepathparts treePathParts uo| |0 currenttree currentTree rR{z {.ascrerr ******** oy y0errmsgerrMsgz skX\ LXZ mXYx x boovfalsw l[[vv 2, The one of the folders named does not existX The one of the folders named does not existw 0i om01uu pI16ts t.corecnte******** o12r r0 treepathparts treePathPartss R4 q q FCdw m pp P4o o docu mnnNm Ldf odel l0 currenttree currentTreem KmOFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/E lkjikji iZ] Ihg h0 movetosection moveToSection of f0treepathtreePathe od d0 newtemplate newTemplateeg O k O k  l cbacba l `` F@set currentTree to first tree of sidebar whose name is "Library"set currentTree to first tree of sidebar whose name is "Library" r  n  I _^ _0 getpathparts getPathParts] o \ \0treepathtreePath]^ f o[ [0 treepathparts treePathParts lZYXZYX QL kB I/W W.coremovenullobj oV V0 newtemplate newTemplateUT U insh n+ 9)+S S insl l)RQ 6) 4P P FCSX mOO =( 1!N N pnam l"'ML n"' 4$'K K cobj m%&JJ o"$I I0 treepathparts treePathPartsMLRQTH r0B l0@GF 60@ 404E E FCSX m23DD =5? 168C C pnam l9>BA n9> 4;>@ @ cobj m<=?? o9;> >0 treepathparts treePathPartsBAGF o= = 0currentsectioncurrentSectionH R<;: <.ascrerr ********;: LJL mJK9 9 boovfals YM87 Q[ k^ I^v6 6.coremovenullobj o^_5 50 newtemplate newTemplate43 4 insh n`r 9pr2 2 insl l`p10 6`p n`d 4ad/ / FCSX mbc.. o`a- - 0currentsectioncurrentSection =eo 1fh, , pnam lin+* nin 4kn) ) cobj olm( (0i oik' '0 treepathparts treePathParts+*103& rw lw%$ 6w nw{ 4x{# # FCSX myz"" owx! ! 0currentsectioncurrentSection =| 1}  pnam l n 4  cobj o 0i o 0 treepathparts treePathParts%$ o  0currentsectioncurrentSection& R .ascrerr ******** o 0errmsgerrMsg k L m  boovfals   l    2, The one of the folders named does not exist   X The one of the folders named does not exist 80i mPQ IQV  .corecnte********  oQR 0 treepathparts treePathParts7 I .coremovenullobj o 0 newtemplate newTemplate   insh n 9  insl l  n 4  FCSX m o  0currentsectioncurrentSection   4  docu m L o  0currentsectioncurrentSection mOFOCalis:HD~(H+ 2 OmniFocus.appaè Applications~nèh 2HD:Applications:OmniFocus.app OmniFocus.appHDApplications/OmniFocus.app/ l i^a !  I" 0 getpathparts getPathParts"# #o 0treepathtreePath !k/$$%& %r '( 'n)* )I+ 0explode+,- ,m..//:-01 0o 0treepathtreePath12 2m  boovfals *f (o 0 pathparts pathParts&34 3Y ,567 5r'89 8n":; :I"< 0trim<= =n>? >4@  cobj @o 0i ?o 0 pathparts pathParts ;f 9nAB A4#&C  cobj Co$% 0i Bo"# 0 pathparts pathParts 0i 6m 7lD DIE .corecnte******** Eo 0 pathparts pathParts4F FL-/G Go-. 0 pathparts pathPartsHI HlIJK JibeLM LIN 0explodeNOP Oo 0 delimiterPQR Qo 0sometextsomeTextRS So 0limit MkTTUV UlWX WJD by Bruce Phillips http://bbs.applescript.net/viewtopic.php?id=18377XYY by Bruce Phillips http://bbs.applescript.net/viewtopic.php?id=18377VZ[ Zr\] \c^_ ^o 0limit _m  long ]o 0limit[`a `r bc bn de d1  txdl e1  ascr co 0prevtidsprevTIDsafg fr hi ho 0 delimiter injk j1  txdl k1   ascrglm lrno nnpq p2  citm qo 0sometextsomeText oo 0outputmrs rlstu tZvvwx vByz yo 0limit zm wQF{|} {Z!:~ ~A!$ o!" 0limit m"# r'6 n'4 7(4  cobj m,. l/3 \/3 o01 0limit m12 o'( 0output o 0output |R .ascrerr ******** }rBF JBD o 0outputx AIR oIJ 0limit lJQ \JQ lJO IJO .corecnte******** oJK 0output mOP rUr bUp lU` nU` 7V`  cobj mZ\ o]_ 0limit oUV 0output l `o l`o b`o m`a nan 7bn  cobj lfj [fj ogh 0limit mhi mkm oab 0output o 0outputu lww rw| owx 0prevtidsprevTIDs n 1y{  txdl 1xy  ascr l}} L} o}~ 0outputK l ifi I 0trim o 0s kS l _Yby John Delacour http://lists.apple.com/archives/applescript-users/2002/Aug/msg00161.htmlby John Delacour http://lists.apple.com/archives/applescript-users/2002/Aug/msg00161.html l r J 1  spac n 1  txdl 1~ ~ ascr r  n  2 } } citm o | |0s o{ {0l r Jz mz n 1y y txdl 1x x ascr lwvuwvu ltt D> Prepend a space to every non-blank text item except the first| Prepend a space to every non-blank text item except the first r ms s boovfals or r 0started XNq Z*Ipo ?*1 l*/nm I*/lk l.corecnte******** o*+j j0thisitemthisItemknm m/0ii Z4Eh o45g g 0started r8? l8;fe b8; 189d d spac o9:c c0thisitemthisItemfe n 1<>b b pcnt o;P ONMLKJIHGFEDCBA@?>=<;:987654 O&0placeholderopenerplaceholderOpener N&0placeholdercloserplaceholderCloser M0 growlappname growlAppName L20scriptstartnotificationscriptStartNotification K40scriptfinishnotificationscriptFinishNotification J,0defaultnotificationsdefaultNotifications I$0allnotificationsallNotifications H00iconloaningapplicationiconLoaningApplication G60locationplaceholderopenerlocationPlaceholderOpener F60locationplaceholdercloserlocationPlaceholderCloser E00parseplaceholderstringparsePlaceholderString D&0cleanplaceholderscleanPlaceholders C"0getreplacementsgetReplacements B*0getdatedifferentialgetDateDifferential A00buildreplacementscriptbuildReplacementScript @*0replaceplaceholdersreplacePlaceholders ?>0replaceplaceholdersinchildrenreplacePlaceholdersInChildren >0 replacetext replaceText =0 updatedate updateDate <&0stripplaceholdersstripPlaceholders ; 0notify :@0parselocationplaceholderstringparseLocationPlaceholderString 9$0getspecifiedtreegetSpecifiedTree 80 movetosection moveToSection 70 getpathparts getPathParts 6 0explode 50trim 4.aevtoappnull**** 3 3 - 2!2!-(10/"#. 100parseplaceholderstringparsePlaceholderString0-$-$, ,0 thestring theString/"+*)( +0 thestring theString *0olddelimoldDelim )0 firstparse firstParse (0 theresult theResult#'&%$# ' ascr & txdl % citm $ rest #&0cleanplaceholderscleanPlaceholders.6,EOb,FO-,EOb,FO*jvl+EO,FO"! %& "&0cleanplaceholderscleanPlaceholders!'' 0thelisttheList  0accum % 0thelisttheList  0accum 0 firstitem firstItem&  cobj  citm  cha .corecnte********  rest &0cleanplaceholderscleanPlaceholders0replaceplaceholdersinchildrenreplacePlaceholdersInChildren  rest *0replaceplaceholdersreplacePlaceholders%jvhYhO*k/m+O*,m+45 >0replaceplaceholdersinchildrenreplacePlaceholdersInChildren66 0thetasktheTask 0 thecommand theCommand $0datedifferentialdateDifferential4 0thetasktheTask 0 thecommand theCommand $0datedifferentialdateDifferential5 "  pnam  TEXT 0 replacetext replaceText  FCDd 0 updatedate updateDate  FCDs  FCno  msng  FCac *0replaceplaceholdersreplacePlaceholdersUZ),&l+,FO),l+,FO),l+,FO,),&l+,FYhO)-m+ {78 0 replacetext replaceText99 0thetexttheText 0 thecommand theCommand7 0thetexttheText 0 thecommand theCommand 0 quotedtext quotedText8  strq .sysoexecTEXTTEXT,EO%%j EO:; 0 updatedate updateDate<< 0 originaldate originalDate $0datedifferentialdateDifferential: 0 originaldate originalDate $0datedifferentialdateDifferential 0newdatenewDate;  msng  bool &YhOEO=> &0stripplaceholdersstripPlaceholders  from 0thenotetheNote= 0thenotetheNote 0 noteparts noteParts>  cpar .corecnte********  ctxt&-j kYhO[\[k/\/2EO?@ 0notifyAA 0thetitletheTitle 0thedescriptiontheDescription *0thenotificationkindtheNotificationKind? 0thetitletheTitle 0thedescriptiontheDescription *0thenotificationkindtheNotificationKind@ ~}|{zyx  appl  anot  dnot ~ iapp} |.registernullnull { name z titl y desc x.notifygrnullnull51*bbbb O*b UwvuBCt w@0parselocationplaceholderstringparseLocationPlaceholderStringvsDsDr r0 thestring theStringuBqpon q0 thestring theString p0olddelimoldDelim o0 firstparse firstParse n0 theresult theResultCmlkji m ascr l txdl k citm j rest i&0cleanplaceholderscleanPlaceholderst6,EOb,FO-,EOb ,FO*jvl+EO,FOhGgfEFe h$0getspecifiedtreegetSpecifiedTreegdGdGc c0treepathtreePathfEba`_^ b0treepathtreePath a0 currenttree currentTree `0 treepathparts treePathParts _0i ^0errmsgerrMsgF ]\[ZHY_XWVUT ] docu \ FCdw [ FCSt Z OTtrH Y pnam X0 getpathparts getPathParts W.corecnte******** V cobj U0errmsgerrMsgTehd*k/Y*k/Q*,k/[,\Z81EO)k+EO3kj khk/[,\Z/81EW X fOP[OYUUOUSRQIJP S0 movetosection moveToSectionROKOKNM N0treepathtreePath M0 newtemplate newTemplateQILKJIHG L0treepathtreePath K0 newtemplate newTemplate J0 treepathparts treePathParts I 0currentsectioncurrentSection H0i G0errmsgerrMsgJFEDCHBA@?>=<; F docu E0 getpathparts getPathParts D insh C FCSX B pnam A cobj @ insl ?.coremovenullobj >= <.corecnte******** ;0errmsgerrMsgP*k/)k+EO0*k/[,\Zk/814l O*k/[,\Zk/81EW X fOLlj kh0k/[,\Z/814l Ok/[,\Z/81EW X fOP[OYOi/4l UOU:!98LM7 :0 getpathparts getPathParts96N6N5 50treepathtreePath8L432 40treepathtreePath 30 pathparts pathParts 20iM.10/. 1 0explode 0.corecnte******** / cobj .0trim70)fm+EO kj kh)/k+/F[OYO-M,+OP* - 0explode,)Q)Q('& ( 0 delimiter '0sometextsomeText & 0limit+O%$#"! % 0 delimiter $0sometextsomeText # 0limit "0prevtidsprevTIDs ! 0outputP   long  ascr  txdl  citm  cobj .corecnte*********&EO,EO,FO-EOj-j[\[Zk\Zk2EYhW XjvEY/j k"[\[Zk\Z2[\[Zk\Zi2%%EYhO,FORS 0trimTT 0sR 0s 0l  0started 0thisitemthisItemS     spac  ascr  txdl  citm  kocl  cobj .corecnte********  pcnt  TEXTTkv,FO-EOkv,FOfEO3[l khj j %,FYeEYh[OYO&UVW .aevtoappnull**** Uk=XXBYYV 0msg 0numWY~TmZ  docu  FCdw  FCcn  OTst $0theselecteditemstheSelectedItems .corecnte********  FCSt  mesS  as A  EAlTwarN .sysodisAaleRTEXT  cobj  valL 0 selecteditem selectedItem  pnam 0theprojectnametheProjectName  FCno 0thenotetheNote "0theplaceholdersthePlaceholders  cpar ,0theplaceholderstringthePlaceholderString 00parseplaceholderstringparsePlaceholderString  ret  btns  dflt  FCDs 0 thestartdate theStartDate  FCDd 0 theduedate theDueDate  insh  FCSX  insl .coreclon******** 0duplicateditemduplicatedItem "0getreplacementsgetReplacements "0thereplacementstheReplacements  msng *0getdatedifferentialgetDateDifferential $0datedifferentialdateDifferential 0notify  FCrt 0thetasktheTask 0msgZ  errn 0num\ .sysobeepnulllong  errn 00buildreplacementscriptbuildReplacementScript 0 thecommand theCommand *0replaceplaceholdersreplacePlaceholders  from &0stripplaceholdersstripPlaceholders 0 replacetext replaceText 0 newtemplate newTemplate  FCPsFCPa  FCPs 0notestrnoteStr @0parselocationplaceholderstringparseLocationPlaceholderString 0treepathtreePath $0getspecifiedtreegetSpecifiedTree 0 foundpath foundPath 0 movetosection moveToSection 0 movedtemplate movedTemplate .sysodlogaskrTEXT>*k/x*k/*,-EOj k *,-EYhUOj k OhYhOj ka OhYhOak/a,E`O_a,E`O_a,E`OjvE`O_ai/E`O)_k+E`WXhO_j jSa_%a%a _!%b%a"%b%a#%b%a$%b%a%a&kva'ka( OhYhO_a),E`*O_a+,E`,Oak/a,a-*a.i/a/4l 0O*a.i/E`1O)_jvl+2E`3O_3j jhYhO_,a4%)a5_,l+6E`7O_7a4hYhY6_*a4%)a8_*l+6E`7O_7a4hYhY a4E`7O)a9a:_%a;%bm+W)X?@aA_1kvE`>Y*j BO)aClO)__3aDm+EE`FO)_>_F_7m+GO)aH_l IE`O)__Fl+JE`O__1a,FUO)aKaLbm+