11.1.1.3. Felix COM API Code Samplesยถ
This page contains code samples to illustrate the use of the COM API.
11.1.1.3.1. Look up a Queryยถ
This will look up a query in the Felix window:
Dim felix As Object
Set felix = CreateObject("Felix.App")
felix.LookUp "My query"
11.1.1.3.2. Get Translation Infoยถ
This will print out information about the match suggested for the current query:
Dim felix As Object
Set felix = CreateObject("Felix.App")
Debug.Print "Number of matches:" & felix.NumMatches
Debug.Print "Score: " & felix.Score
Debug.Print "Translation: " & felix.trans
11.1.1.3.3. Set the Translation for a Queryยถ
Here, we will look up a sentence, and then provide a translation:
Dim felix As Object
Set felix = CreateObject("Felix.App")
felix.LookUp "My query"
felix.Trans = "This is the translation"
11.1.1.3.4. Merge Two TMsยถ
Hereโs a slightly more involved example. Here, weโll load two TMs, merge them into a single TM, and then save it with a new name:
Dim felix As Object
Set felix = CreateObject("Felix.App")
' load the two mems
Dim mem1, mem2 As Object
Set mem1 = felix.App2.Memories.Load("c:\mem1.ftm")
Set mem2 = felix.App2.Memories.Load("c:\mem2.ftm")
' Now add all the records in mem2 to mem1
For Each record In mem2.Records
mem1.AddRecord record
Next record
' Finally, save the mem with a new name
mem1.SaveAs "c:\merged.ftm"