FasdUAS 1.101.10 k l +% MarsEdit Create Footnote AppleScript  J MarsEdit Create Footnote AppleScript l   Author: Shimone Samuel . Author: Shimone Samuel  l " Date: Monday, July 14, 20088 Date: Monday, July 14, 2008 l  Revision: 1.5 Revision: 1.5 l l  Description: This AppleScript is based loosely on the AppleScript "Add List Tags" by Spyros Smparounis which itself is based loosely on "Add Paragraph Tags" which was included with MarsEdit 1.1.2. Description: This AppleScript is based loosely on the AppleScript "Add List Tags" by Spyros Smparounis which itself is based loosely on "Add Paragraph Tags" which was included with MarsEdit 1.1.2. ! l!"# "l$% $2, What the "Create Footnote" AppleScript does%&&X What the "Create Footnote" AppleScript does#'( 'l()* )l+, +/) Check if MarsEdit has a post window open,--R Check if MarsEdit has a post window open*./ .l01 093 If no post window is open, return an error message122f If no post window is open, return an error message/34 3l56 55/ Check if post window contains a text selection677^ Check if post window contains a text selection489 8l:; :.( If no text is selected, return an error;<<P If no text is selected, return an error9=> =l?@ ?(" Store the selection as a variable@AAD Store the selection as a variable>BC BlDE D5/ Store the date and time as a unique identifierEFF^ Store the date and time as a unique identifierCGH GlIJ I@: Replace the selected text with unique link and identifierJKKt Replace the selected text with unique link and identifierHLM LlNO N>8 Update clipboard with unique identifier and return linkOPPp Update clipboard with unique identifier and return linkMQR QlRST SlUV U Shimone SamuelVWW Shimone SamuelTXY XlZ[ Z shimone@staticbeasts.com[\\2 shimone@staticbeasts.comY]^ ]l_` _ www.likewowonline.net`aa, www.likewowonline.net^bc blcde dlfg f Release Log:ghh Release Log:eij ilkl k 1.0: Initial versionlmm* 1.0: Initial versionjno nlpq p" 1.5 : Add accessible titlesqrr8 1.5 : Add accessible titlesost sltuv ulwx w Error message formattingxyy2 Error message formattingvz{ zi|} |I~ *0displayerrormessagedisplayErrorMessage~ o 0s }I .sysodlogaskrTEXT l o 0s  btns J mOK  dflt mOK  disp m  stic{ l l O k l Q k r 4  docu m  o 0 currentwindow currentWindow l GA There are no post windows open, so return now and alert the user There are no post windows open, so return now and alert the user R .ascrerr ******** o 0 errormessage errorMessage k  n I *0displayerrormessagedisplayErrorMessage mCan t add a reference because no post windows are open. This script works on text in the frontmost post window. f L  l!! r!& n!$ 1"$  PsSt o!" 0 currentwindow currentWindow o "0currenttextviewcurrentTextView l'' l'' 82 If no text selected return now and alert the userd If no text selected return now and alert the user Z': ='* o'( "0currenttextviewcurrentTextView m() k-6 n-3 I.3 *0displayerrormessagedisplayErrorMessage m./@You must select some text first. f-. L46 l;; r;> m;< o 0 newbodytext newBodyText r?F I?D .misccurdldt null o 0thedatetheDate rGR lGN cGN lGJ nGJ 1HJ  time oGH 0thedatetheDate mJM  ctxt o 0 thereference theReference lSS lSS lSS lSS .( Encase each paragraph in
  • tagsP Encase each paragraph in <li></li> tags ZS lSX >SX oST "0currenttextviewcurrentTextView mTW r[| b[z b[v b[t b[p b[n b[j   b[h   b[d   b[` o[\ 0 newbodytext newBodyText m\_<sup><a href="# o`c 0 thereference theReference  mdg" id="fn  ohi "0currenttextviewcurrentTextView mjm," title="see footnote ono "0currenttextviewcurrentTextView mps"> otu "0currenttextviewcurrentTextView mvy</a></sup> o~ ~0 newbodytext newBodyText l r b !  b"# "b$% $o} }0 newbodytext newBodyText %m&&''<sup><a href="# #o| |0 thereference theReference !m(())$" id=""></a></sup> o{ {0 newbodytext newBodyText -' just add a return for empty paragraphs**N just add a return for empty paragraphs+, +lzyxzyx,-. -lw/0w /(" Add the footnote to the clipboard011D Add the footnote to the clipboard.23 2Iv4u v.JonspClpnull**** 4b56 5b78 7b9: 9b;< ;m==>><li id=" <ot t0 thereference theReference :m??@@.">FOOTNOTE <a href="#fn 8os s"0currenttextviewcurrentTextView 6mAABBL" title="return to article">!</a></li>u3CD ClrqprqpDEF EloGHo G% Put the new text in the windowHII> Put the new text in the windowFJK JrLM Lon n0 newbodytext newBodyText MnNO N1m m PsSt Ool l0 currentwindow currentWindowKPQ PlkjikjiQRS RlhgfhgfSTe Tldcbdcbe mUUMEblalisT Macintosh HDFH+ MarsEdit.app5~n ApplicationsG,v~ &Macintosh HD:Applications:MarsEdit.app MarsEdit.app Macintosh HDApplications/MarsEdit.app/aVWXaV`_ `*0displayerrormessagedisplayErrorMessage _.aevtoappnull****W^}]\YZ[ ^*0displayerrormessagedisplayErrorMessage]Z[Z[Y Y0s\YX X0sZWVUTSR W btns V dflt U disp T sticS R.sysodlogaskrTEXT[kv XQ\PO]^N Q.aevtoappnull**** \k__MMPO]L L0 errormessage errorMessage^UKJIHGFEDCBA@?&(=?A> K docu J0 currentwindow currentWindow I0 errormessage errorMessageH G*0displayerrormessagedisplayErrorMessage F PsSt E"0currenttextviewcurrentTextView D0 newbodytext newBodyText C.misccurdldt null B0thedatetheDate A time @ ctxt ?0 thereference theReference >.JonspClpnull****N *k/EOPWX)k+OhO,EO)k+OhYhOEO*j EO,a&E`Oa&a%_%a%%a%%a%%a%EYa%_%a%EOa_%a%%a%j O,FOPUascr ޭ