[www.theword.net]

Twitter live feed  
View unanswered posts | View active topics It is currently Mon Sep 25, 2017 9:53 am



Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
 roman numerals in clipboard monitor 
Author Message
User avatar

Joined: Wed Jun 04, 2008 7:34 pm
Posts: 3481
Post Re: roman numerals in clipboard monitor
He will see it when he gets back to the forum.

_________________
Jon
the
Word 5 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet


Sat Jan 09, 2016 12:34 pm
Profile
Site Admin

Joined: Tue Aug 29, 2006 2:09 pm
Posts: 8552
Location: Corfu, Greece
Post Re: roman numerals in clipboard monitor
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


Sat Jan 16, 2016 3:07 pm
Profile WWW

Joined: Tue Oct 07, 2008 3:41 am
Posts: 10
Post Re: roman numerals in clipboard monitor
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


Sun Jan 17, 2016 12:06 am
Profile
User avatar

Joined: Wed Jun 04, 2008 7:34 pm
Posts: 3481
Post Re: roman numerals in clipboard monitor
No Phil, there is nothing you can do. The feature has been removed from the program itself.

_________________
Jon
the
Word 5 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet


Sun Jan 17, 2016 12:12 am
Profile

Joined: Mon Nov 28, 2016 1:58 am
Posts: 1
Post Re: roman numerals in clipboard monitor
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:
#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
}



Mon Feb 06, 2017 6:55 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 20 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.