Loading ...
Sorry, an error occurred while loading the content.

and the clip for search and replace bible verses

Expand Messages
  • Don - htmlfixit.com
    ; counter at ND ;^!SetScreenUpdate Off ; UNCOMMENT ABOVE IF YOU DARE :-) ^!ClearVariables ^!SetArray
    Message 1 of 3 , Nov 27, 2004
    • 0 Attachment
      ; counter at ND
      ;^!SetScreenUpdate Off
      ; UNCOMMENT ABOVE IF YOU DARE :-)
      ^!ClearVariables
      ^!SetArray
      %Original%="Ge";"Ex";"Le";"Nu";"De";"Jos";"Jg";"Ru";"1Sa";"2Sa";"1Ki";"2Ki";"1Ch";"2Ch";"Ezr";"Ne";"Es";"Job";"Ps";"Pr";"Ec";"Ca";"Isa";"Jer";"La";"Eze";"Da";"Ho";"Joe";"Am";"Ob";"Jon";"Mic";"Na";"Hab";"Zep";"Hag";"Zec";"Mal";"Mt";"Mr";"Lu";"Ac";"Ro";"1Co";"2Co";"Ga";"Eph";"Php";"Col";"1Th";"2Th";"1Ti";"2Ti";"Tit";"Phm";"Heb";"Jas";"1Pe";"2Pe";"1Jo";"2Jo";"3Jo";"Joh";"Jude";"Rev"
      ^!SetArray
      %New%="Gen_";"Exo_";"Lev_";"Num_";"Deu_";"Jos_";"Jdg_";"Rth_";"1Sa_";"2Sa_";"1Ki_";"2Ki_";"1Ch_";"2Ch_";"Ezr_";"Neh_";"Est_";"Job_";"Psa_";"Pro_";"Ecc_";"Son_";"Isa_";"Jer_";"Lam_";"Eze_";"Dan_";"Hos_";"Joe_";"Amo_";"Oba_";"Jon_";"Mic_";"Nah_";"Hab_";"Zep_";"Hag_";"Zec_";"Mal_";"Mat_";"Mar_";"Luk_";"Act_";"Rom_";"1Co_";"2Co_";"Gal_";"Eph_";"Phi_";"Col_";"1Th_";"2Th_";"1Ti_";"2Ti_";"Tit_";"Phm_";"Heb_";"Jam_";"1Pe_";"2Pe_";"1Jo_";"2Jo_";"3Jo_";"Joh_";"Jud_";"Rev_"
      ^!Set %N%=0

      ; Clear problem with .) convert to ).
      ^!Replace ".)" >> ")." ACIWS


      :FIND
      ^!Jump 1
      ^!Inc %N%

      ; look for current book
      ^!Find "^%Original^%N%% " CWS
      ^!IfError NextBook

      :PositiveFind
      ; found the current book so process for it
      ^!Jump 1
      ^!Set %NA%=0

      ; **************************************************
      :LoopParens
      ; first look in parenthesis sets for
      ; current book (this is one of two major
      ; parts of the clip)
      ; **************************************************


      ; find matched parenthesis
      ; select inside of them and
      ; look there for current book
      ^!Find "(" TIS
      ^!IfError NextBook

      ^!Jump Select_End
      ^!Set %cursor_row%=^$GetRow$
      ^!Set %cursor_col%=^$GetCol$
      ^!Find ")" TIS
      ^!Jump Select_Start
      ^!Set %cursor_row_end%=^$GetRow$
      ^!Set %cursor_col_end%=^$GetCol$
      ^!SelectTo ^%cursor_row%:^%cursor_col%
      ^!Set %TempVar%=^$GetSelection$
      ^!Set %NA%=^$StrCount("^%Original^%N%%";"^%TempVar%";True;True)$
      ; did we find the current book inside
      ; of the current pair of parenthesis?
      ; branch accordingly
      ^!If "^%NA%" > "0" FOUND ELSE NOTFOUND

      :FOUND
      ; error trap: should only have one
      ^!If "^%NA%" < "2" SKIP
      ^!Continue ^%NA% is greater than one ... error!
      ; end of error trap

      :ProcessParens
      ; split variable at the current book so
      ; we can discard before and use after it
      ^!SetListDelimiter "^%Original^%N%%"
      ; dump cumulative placeholder if present
      ^!Set %TempVar%=^$StrReplace("; *h*i*d*d*e*n*";"";"^%TempVar%";False;False)$
      ^!SetArray %split_on_book%=^%TempVar%

      ; start build of replacement text
      ; we will want the discard at the end
      ^!Set %Rebuilt%=^%split_on_book1%*h*i*d*d*e*n*

      ; set counter for loop control
      ; in case bad data needs manual fix
      ^!Set %ND%=0


      :CheckNumber
      ; this routine will tell us if we have another book
      ; we can tell because there will be no non-numbers
      ; if we have just this one book, with the exception of
      ; characters , ; - space which we strip for this
      ; test without removing them ; this is instead of
      ; AlanC's regex given that it won't work on variables
      ^!Set
      %split_on_book2_temp%=^$StrReplace(";";"";"^%split_on_book2%";False;False)$
      ^!Set %split_on_book2_temp%=^$StrReplace("
      ";"";"^%split_on_book2_temp%";False;False)$
      ^!Set
      %split_on_book2_temp%=^$StrReplace(",";"";"^%split_on_book2_temp%";False;False)$
      ^!Set
      %split_on_book2_temp%=^$StrReplace(":";"";"^%split_on_book2_temp%";False;False)$
      ^!Set
      %split_on_book2_temp%=^$StrReplace("-";"";"^%split_on_book2_temp%";False;False)$
      ; basically this is equivalent of ^!Find "[A-Z]"
      ; searching backwards in our variable and failing
      ; only if no alpha characters
      ^!If "^$IsNumber("^%split_on_book2_temp%")$" = "1" IsNumber

      ; strip off book at end with space
      ; note will not take off semi as split with it
      ; note also we will want to save this so ... rebuild again
      ^!SetListDelimiter "; "
      ^!SetArray %split_on_book3%=^%split_on_book2%
      ^!Set %split_on_book2%=^$StrReplace(";
      ^%split_on_book3^%split_on_book30%%";"";"^%split_on_book2%";False;False)$

      ; continue build of replacement text
      ^!Set %Rebuilt%=^$StrReplace("*h*i*d*d*e*n*";"*h*i*d*d*e*n*;
      ^%split_on_book3^%split_on_book30%%";"^%Rebuilt%";True;False)$
      ; ^!Continue Rebuilt: ^%Rebuilt%

      ; Set Loop Control to Trap Bad Data
      :LoopCheck
      ^!Inc %ND%
      ;^!Info x is ^%x% and mod is ^$calc(^%x% mod 15)$
      ^!If "^$calc(^%ND% mod 15)$" <> "0" NoStop
      ^!Continue Loop Has Run ^%ND% Times -- See Hint Info
      :Loop-Keypress
      ^!SetHintInfo press [CONTROL KEY] after edit to continue; press
      [ALT+CONTROL KEYS] to stop clip.
      ^!IfTrue ^$IsCtrlKeyDown$ StopOver
      ^!Goto Loop-Keypress
      :StopOver
      ; because edit blows away select
      ; need to research under this book
      ; so back to start of find cycle
      ^!Goto PositiveFind
      :NoStop


      ; cycle again until no extra books
      ^!GoTo CheckNumber


      :IsNumber
      ; finally no extra books
      ; need to now process
      ; first split if semis
      ; if part two has no semi we are good to process
      ; otherwise multiple chapters
      ^!Set %NB%=1
      ^!SetListDelimiter "; "
      ^!SetArray %split_on_chapters%=^%split_on_book2%

      :GetChapter
      ; get verse(s)
      ^!SetListDelimiter ":"
      ^!SetArray %get_chapter%=^%split_on_chapters^%NB%%
      ; trim the leading space
      ^!If " " <> "^$StrIndex("^%get_chapter1%";1)$" Skip
      ^!Set %get_chapter1%=^$StrDelete("^%get_chapter1%";1;1)$
      ^!Set %NC%=1


      :GetVerse
      ; get verse(s)
      ^!SetListDelimiter ", "
      ^!SetArray %get_verse%=^%get_chapter2%
      ^!Set %Rebuilt%=^$StrReplace("*h*i*d*d*e*n*";"{\cf11\ul
      ^%New^%N%%^%get_chapter1%:^%get_verse^%NC%%};
      *h*i*d*d*e*n*";"^%Rebuilt%";True;False)$

      ; link form for esword
      ; {\cf11\ul 1Ch_27:32}
      ;^!Continue Verse ^%get_verse0% and ^%NC%
      ;^!Continue Chapters ^%get_verse0% xx ^%get_verse1%


      ; cycle back for another verse until out of them
      ; under this chapter
      ^!Inc %NC%
      ^!If "^%get_verse0%" >= "^%NC%" GetVerse


      ; cycle back for another chapter until
      ; out of them
      ^!Inc %NB%
      ^!If "^%split_on_chapters0%" >= "^%NB%" GetChapter


      :GoToNextParen
      ^!InsertSelect ^%Rebuilt%
      ; once out of chapters and verses within
      ; chapters, then move cursor to end of
      ; selection and go again
      ^!SetCursor ^%cursor_row_end%:^%cursor_col_end%
      ^!GoTo LoopParens
      ^!Continue Hit Cancel

      :NOTFOUND
      ;^!Continue ^%Original^%N%% Not Found
      ^!Jump Select_End
      ^!GoTo LoopParens

      ^!Continue Hit Cancel


      :NextBook
      ;^!Continue ^%N%=^%Original0%

      ^!If ^%N%=^%Original0% FinalCleanUp
      ^!GoTo FIND

      :FinalCleanUp
      ^!Replace "; *h*i*d*d*e*n*" >> "" ATIWS
      ^!SetScreenUpdate On
      ^!Continue DONE

      ^!GoTo End
    • Alan C.
      Hi Don, Everyone, Don I couldn t get your clip to parse/work anything other than it did bring up a so many loops prompt. Likely it got messed up in the email
      Message 2 of 3 , Nov 28, 2004
      • 0 Attachment
        Hi Don, Everyone,

        Don I couldn't get your clip to parse/work anything other than it did bring up a so many loops prompt. Likely it got messed up in the email and I didn't get it sufficiently straightened out yet.

        I was gonna write a Perl version to do the job. But my computer/work area is not ready -- I need lots reference yet when do Perl because after 2+ years worth I'm still in newbie to intermediate land on Perl. Work area is not yet assembled enough for my Perl progress. But soon will be, I won't wait long.

        I need but very little to no reference for Notetab clip. Tinkerer me, well . . . and no ref needed, work area is already adequate for clip . . .

        temporarily, the clips and ini that I've created/made re this thread are on my web site. If I've the time, I may completely finish it. It works now but is commented for more 2 come. Others are welcome to take it from where it's now at if they so desire.

        How it works: Uses an ini that must be placed in the notetab libraries folder. that ini acts as a look up table, provides a "data index" to be then used by the getfield function

        ^!Set %nwbook%=^$GetField(-1;^%datcol%)$

        listbuildr clip pumps out the data (into a scratch doc) that GetField accesses such data. But via the ini is how the getfield recieves an index, a data index which speaks/interacts with the GetField function, tells GetField which_specific_item to snag. Neat. Fun stuff.

        ini, look up table, use_a looked_up_index to get_a particular data_field, use that particular data field to replace the original (Le etc.) with the new.

        Tinkering/working results:

        http://users.cwnet.com/acummi/temp/bookparseit.txt

        http://users.cwnet.com/acummi/temp/versesmore.ini

        http://users.cwnet.com/acummi/temp/versesmore.txt

        versesmore.ini and versesmore.txt are the exact same file except I named each with a different file extension. (my web browser thought a virus might be attacking me when I www browsed for the ini file extension file).

        So, can do the versesmore.txt rename it to versusmore.ini and drop it in the notetab libraries directory.

        bookparseit.txt is a series of seven clips can copy all then paste all 7 into a clip library.

        Later. Alan.
      • Alan C.
        On Sun, 28 Nov 2004 03:41:28 -0800, Alan C. wrote: [ . . ] ... oop, misspelling there. there is no versusmore it is supposed to be versesmore.ini Alan.
        Message 3 of 3 , Nov 28, 2004
        • 0 Attachment
          On Sun, 28 Nov 2004 03:41:28 -0800, Alan C. wrote:
          [ . . ]
          > So, can do the versesmore.txt rename it to versusmore.ini

          oop, misspelling there. there is no versusmore it is supposed to be versesmore.ini

          Alan.
        Your message has been successfully submitted and would be delivered to recipients shortly.