This software is part of the OpenLingua project.

TMexports

Batch export of translation memories from Trados Translators Workbench




Here is a Visual Basic script I used with MS Word for finding all Translation Memories (TM) in a given directory and exporting them using Trados Translators Workbench (TW), while at the same time creating a list of the files with more data about the TMs (which is not normally exportet by Translators Workbench into the export file, at least not when exporting to format TMX with TW version 6).

Features:

With this macro, I exported 221 TMs with a total size of (exported) 480 MB, or a total of about 680000 TUs, in only 9 minutes (on an Athlon 2 GHz and a current disk speed). And it's so easy to redo it...

In order to use this macro, copy-paste it into a code window in the macro editor of MS Word (the colors will be different), adapt the relevant parts (shown in red above and below), then run it. Be sure to have the Workbench running, otherwise you will run into an error.

You also have to activate a certain option in the macro editor. In the macro editor, go to "Tools - Links" (or something similar, it's the first menu item; in the German version it's called "Extras - Verweise") and activate the item "TRADOS Translators Workbench 6.5". If this item is not activated, you will get an error message in the first line of the macro ("Dim oWorkbench As TW4Win.Application").

Good luck, if you decide to use it. It should work right away after setting your personal directory and user name data (described above). But as always with free software: there is no warranty for anything. If you are worried, check the code youself (the documentation coming with your visual basic editor in Word should be enough). Have backups.


License:

This software is released under the current General Public License (GPL).
Read more about free software - "free" as defined by the Free Software Foundation (FSF) - and the GPL here: http://www.fsf.org.

Other info:

Important: Currently (since June 2004 -- and still ongoing), there is a struggle going on in Europe and elsewhere, where some powerful people want to allow software to be patented. If these tyrannic people (who may be very nice otherwise, for instance on a more personal level, but they want to impose their will on others, which is what tyrants do), who work with bad tricks, lies and deception to have politicians make laws to get their way, they will have a means to stiffle creative and independent software development -- no more freedom. Please do something to prevent or abolish software patents, which are nothing else than a forceful colonialization of the mind and what they produce in order to set up commercial monopolies. More info here: http://ffii.de (in German) or here: http://www.fsf.org.


Sub TMexports()
'
' TMexports Makro
' TMexports V1.0, erstellt am 22.06.2004 von Peer Janssen. Released under the GPL.
'

Dim oWorkbench As TW4Win.Application
Dim oTM As TW4Win.TranslationMemory
Dim oOptionsGeneral As TW4Win.OptionsGeneral
Dim oProperties As TW4Win.Properties

Set oWorkbench = GetObject(, "TW4Win.Application")
Set oTM = oWorkbench.TranslationMemory

Set oOptionsGeneral = oWorkbench.OptionsGeneral
SaveOptionsMode = oOptionsGeneral.ShowProjectSettings
oOptionsGeneral.ShowProjectSettings = False

Open "D:\Exports_TM-List.txt" For Output As #2
Print #2, "i" + Chr(9) + "Exportet" + Chr(9) + "Path" + Chr(9) + "Name" + Chr(9) + "CrD" + Chr(9) + "CrU" + Chr(9) + "DBVersion" + Chr(9) + "Multi" + Chr(9) + "Size" + Chr(9) + "TUs"
Count = 1 Set fs = Application.FileSearch With fs .NewSearch .LookIn = "D:\_WorkDir"
.FileName = "*.tmw"
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles

If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
Debug.Print "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
If InStr(1, .FoundFiles(i), "_TMs_TW1") = 0 Then
oTM.Open .FoundFiles(i), "PJ" 'Set Username here
Set oProperties = oTM.Properties
ExportFile = "D:\TMexport-" + CStr(Count) + ".tmx"
Debug.Print Count, ExportFile, oTM.FileName
With oProperties
Print #2, CStr(Count) + Chr(9) + ExportFile + Chr(9) + .Path + Chr(9) + .Name + Chr(9) + .CreationDate + Chr(9) + .CreationUser + Chr(9) + CStr(.DatabaseVersion) + Chr(9) + CStr(.MultipleTranslationSupport) + Chr(9) + CStr(.Size) + Chr(9) + CStr(.TranslationUnits)
End With
oTM.Export ExportFile, twbFormatTMX 'This is for TMX export. For other formats, uncomment one of the next lines instead, and adapt the file name (see above the .tmx). 'oTM.Export ExportFile, twbFormatDOS 'oTM.Export ExportFile, twbFormatLogos 'oTM.Export ExportFile, twbFormatSystran 'THIS FORMAT DOESNT WORK! oTM.Export ExportFile, twbFormatTM2 'oTM.Export ExportFile, twbFormatTWB1x 'oTM.Export ExportFile, twbFormatTWB2x 'oTM.Export ExportFile, twbFormatTWBCurrent 'oTM.Export ExportFile, twbFormatWordRTF oTM.Close Count = Count + 1 Else Debug.Print "Skipped" End If Next i Else MsgBox "There were no files found." End If End With Close #2 oOptionsGeneral.ShowProjectSettings = SaveOptionsMode End Sub

© 2005-2006 Peer Janssen. Impressum.
Trados Translators Workbench is a product of Trados. MS Word is a product of Microsoft.