roman numerals in clipboard monitor

Have you found a bug or you think that the program does not function as expected? Report it here
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: roman numerals in clipboard monitor

Post by JG »

He will see it when he gets back to the forum.
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
csterg
Site Admin
Posts: 8627
Joined: Tue Aug 29, 2006 3:09 pm
Location: Corfu, Greece
Contact:

Re: roman numerals in clipboard monitor

Post by csterg »

I am afraid this is not possible.
Initially the CM was designed to also take care of Roman numerals. But as more different cases were appearing, it quickly became obvious that the support could never be complete. I chose to drop the support for Roman numerals to have better general support of more common cases.

It is an easy problem to solve when you know you only have a module in English, let's say, that only has Roman numerals, but it is a VERY difficult problem to have all languages and all different styles of verse reference and also include support for Roman numerals,
Sorry
Costas
Philm
Posts: 10
Joined: Tue Oct 07, 2008 4:41 am

Re: roman numerals in clipboard monitor

Post by Philm »

Thanks for your response.

I am still asking isn't there some modification I can make to recognise the Roman numerals I continue to encounter. If so can you point me in the right direction.

Thanks again.
philwithJESUS
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: roman numerals in clipboard monitor

Post by JG »

No Phil, there is nothing you can do. The feature has been removed from the program itself.
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
Reformed Robert
Posts: 1
Joined: Mon Nov 28, 2016 2:58 am

Re: roman numerals in clipboard monitor

Post by Reformed Robert »

Hello everyone,

I've run into the same problem as everyone else. I love reading old Puritan classics where the scripture references are in Roman numerals. Since Roman numerals are harder to decipher manually, the clipboard monitor would be especially useful for Roman numerals. Excited for a challenge and the chance to learn a new programming language, I wrote a quick AutoHotkey script which replaces Roman Numeral references in the clipboard with their integer equivalent. TheWord then automatically recognizes the converted Scripture references. Simply download AutoHotkey (https://autohotkey.com/download/), copy the code below into a ".ahk" file, right click that file, and select "run script". I only run it when I need it, because as Costas mentioned it's difficult or impossible to always know when you're dealing with a scripture reference and therefore it may sometimes modify your clipboard in ways you weren't expecting. Hope this helps some people out,

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#persistent
return

OnClipboardChange:
SetTitleMatchMode, 2
If WinExist("theWord")
{
  change := false
  ClipboardNew := ""
  Word := ""
  loop, Parse, Clipboard, `n
  {
    loop, Parse, A_LoopField, %A_Space%
    {
      WordPrev := Word
      Word := A_LoopField
      if (isBook(WordPrev) && isRoman(Word))
      { 
        ClipboardNew := ClipboardNew . " " . RomanToInt(Word) . ":"
        change := True
      }
      else
      {
        ClipboardNew := ClipboardNew . " " . Word
      }
    }
    ClipboardNew := ClipboardNew . "`n"
  }

  if (change)
  {
    clipboard = %ClipboardNew%
  }
}
return

isBook(word)
{
  booklist = "Genesis,Gen,Ge,Gn,Exodus,Exo,Ex,Exod,Leviticus,Lev,Le,Lv,Numbers,Num,Nu,Nm,Nb,Deuteronomy,Deut,Dt,Joshua,Josh,Jos,Jsh,Judges,Judg,Jdg,Jg,Jdgs,Ruth,Rth,Ru,Samuel,Sam,Sa,Sm,Kings,Kgs,Ki,Kin,Chronicles,Chron,Ch,Chr,Ezra,Ezr,Nehemiah,Neh,Ne,Esther,Esth,Es,Job,Jb,Psalm,Pslm,Ps,Psalms,Psa,Psm,Pss,Proverbs,Prov,Pr,Prv,Ecclesiastes,Eccles,Ec,Ecc,Solomon,Song,Canticle,Cant,Songs,SOS,Isaiah,Isa,Is,Jeremiah,Jer,Je,Jr,Lamentations,Lam,La,Ezekiel,Ezek,Eze,Ezk,Daniel,Dan,Da,Dn,Hosea,Hos,Ho,Joel,Joe,Jl,Amos,Am,Obadiah,Obad,Ob,Jonah,Jnh,Jon,Micah,Mic,Nahum,Nah,Na,Habakkuk,Hab,Zephaniah,Zeph,Zep,Zp,Haggai,Hag,Hg,Zechariah,Zech,Zec,Zc,Malachi,Mal,Ml,Matthew,Matt,Mt,Mark,Mrk,Mk,Mr,Luke,Luk,Lk,John,Jn,Jhn,Acts,Ac,Romans,Rom,Ro,Rm,Corinthians,Cor,Co,Galatians,Gal,Ga,Ephesians,Ephes,Eph,Philippians,Phil,Php,Colossians,Col,Thessalonians,Thess,Th,Thes,Timothy,Tim,Ti,Titus,Tit,Philemon,Philem,Phm,Hebrews,Heb,James,Jas,Jm,Peter,Pet,Pe,Pt,Jo,Joh,Jude,Jud,Revelation,Rev,Re"
  wordtrimmed := Trim(word, OmitChars := "()'t. `r")
  if wordtrimmed in %booklist%
  {
    return True
  }
  else
  {
    return False
  }
}

isRoman(word)
{
  wordtrimmed := Trim(word, OmitChars := "()'t. `r")
  FoundPos := RegExMatch(wordtrimmed, "[^MDCLXVImdclxvi]")
  if (FoundPos = 0 && StrLen(wordtrimmed) > 0)
  {
    return True
  }
  else
  {
    return False
  }
}

RomanToInt(word)
; http://stackoverflow.com/questions/17724887/c-converting-roman-numerals-to-decimals
{
  map := {"M":1000, "D":500, "C":100, "L":50, "X":10, "V":5, "I":1}
  int := 0

  roman := Trim(word, OmitChars := "()'t. `r")

  loop, % StrLen(roman)-1
  {
    i := A_Index
    if (map[SubStr(roman,i,1)] < map[SubStr(roman,i+1,1)])
    {
      int := int - map[SubStr(roman,i,1)]
    }
    else
    {
      int := int + map[SubStr(roman,i,1)]
    }
  }
  int := int + map[SubStr(roman,StrLen(roman),1)]

  return int
}

Post Reply