Command Line Commands

dEVELOPER topic

 

The Excel Import/Export Add-On features two command line functions for importing and exporting text data to and from an Excel spreadsheet.  The Excel spreadsheet used in both of these operations has a given number of columns where each column is assigned a predefined data type.

These functions are used witha the RC-WinTrans command line tool ("RWTCmd.exe") to extend the existing set of RC-WinTrans command line functions with the Excel import/export capability.

Related topics...

 

Commands:

/Export

/Import

Switches:

/keepalive

/log

/macro

/module

Other subjects:

File Names

Return Values

 

 

"/Export" Command

Exports text data from an RC-WinTrans translation project to a Microsoft Excel spreadsheet.  The exported text data can be selected with three optional parameters.

 

SYNTAX:

/Export   (1) ProjectFile  (2) SrcLang   (3) TgtLang   (4) TargetFile  [Options]  \

/macro "ExcelImportExportAddOnV3"  /module "CommandLine"

 

PARAMETERS:

1. ProjectFile

The project file name of the RC-WinTrans translation project file (.rwtproject).
This can be a complete or relative file path.

2. SrcLang

The source language code (e.g., "en-US" for US English or "ja" for Japanese).
Use an empty string ("") for the original language of the project.
Use a language code to export an existing target language as the source language.

3. TgtLang

The target language code (e.g., "en-US" for US English or "ja" for Japanese).

4. TargetFile

The file name of the target file to which data is to be exported.  This is the Excel spreadsheet file (.xls).  The file name can be a complete or a relative file path.

 

OPTIONS:

/trans

Export translated text items.

/nontrans

Export non-translated text items.

/changed

Export translated text items for which the source text has changed.

/append

Appends the exported data to the end of the target file.

/remamper

Removes ampersand characters (&) from the exported source and target texts.

 

RETURN VALUE:

"0" when successful; "-1" for an error.

 

 

SAMPLE 1

 

rwtcmd.exe  /Export  c:\dir\mytrans.rwtproject  ""  "fr"  myExcel.xls   /trans  /a
/
log c:\dir\output.txt  /macro ExcelImportExportAddOnV3  /module CommandLine

 

Exports all translated text items ("/trans") from the French ("fr") target language.  The target Excel spreadsheet is "myExcel.xls" (newly created).
The "SrcLang" parameter is empty ("") to export the original text as the source.

The processing output is written to a text file "output.txt"  (/log c\dir\output.txt).
 

NOTE:  Here the switch "/a" ("keepalive") is used to keep RC-WinTrans running for another command following this one.

 

 

SAMPLE 2

 

rwtcmd.exe  /Export   proj2.rwtproject  ""  "fr"  myExcel.xls   /trans /nontrans /changed
/
append  /macro ExcelImportExportAddOnV3  /module CommandLine

 

Exports translated, non-translated and changed text items from the French ("fr") target language of the project "proj2.rwtproject".  The data will be appended ("/append") to the (existing) target Excel spreadsheet ("myExcel.xls").  The "SrcLang" parameter is empty ("") to export the original text as the source.

 

 

"/Import" Command

Imports translation data from an Excel spreadsheet to an RC-WinTrans translation project.  The Excel spreadsheet must have already been created (exported) with this add-on.

 

SYNTAX:

/Import   (1) ProjectFile  (2) SrcLang   (3) TgtLang   (4) SourceXLSFile  [Options]  \

/macro "ExcelImportExportAddOnV3"  /module "CommandLine"

 

PARAMETERS:

1. ProjectFile

The project file name of the RC-WinTrans translation project file (.rwtproject).
This can be a complete or relative file path.

2. SrcLang

The source language code (e.g., "en-US" for US English or "ja" for Japanese). Use an empty string ("") for the original language of the project.

3. TgtLang

The target language code (e.g., "en-US" for US English or "ja" for Japanese).

4. SourceXLSFile

The file name of the source Excel file from which data is to be imported.  This is the Excel spreadsheet file (.xls).  The file name can be a complete or a relative file path.

 

OPTIONS:

/overwrite

Overwrite existing translations.

/comparefile

The source file names must match in order for a translation to be imported.

/compareid

The item IDs ("Resname" and "Main Resname") must match in order for a translation to be imported.

/comparetype

The resource type must match in order for a translation to be imported.

 

RETURN VALUE:

"0" when successful; "-1" for an error.

 

 

SAMPLE 3

 

rwtcmd.exe  /Import  mytrans.rwtproject  ""  "fr"  myExcel.xls   /compareid  /a
log output.txt  /macro ExcelImportExportAddOnV3  /module CommandLine

 

Imports translations for the translation project "mytrans.rwtproject") from the Excel spreadsheet "myExcel.xls."  The item IDs ("Resname" and "Main Resname") must match in order for a translation to be imported ("/compareid").

The "SrcLang" parameter is empty ("") to export the original text as the source.

The processing output is written to a text file "output.txt"  (/log output.txt).

 

NOTE:  Here the switch "/a" ("keepalive") is used to keep RC-WinTrans running for another command following this one.

 

 

SAMPLE 4

 

rwtcmd.exe  /Import   proj2.rwtproject  ""  "fr"  myExcel.xls   /compareid /overwrite
/
macro ExcelImportExportAddOnV3  /module CommandLine

 

Imports the French translations from an Excel spreadsheet "myExcel.xls" for the translation project "proj2.rwtproject".  An existing translation (if different) will be overwritten ("/overwrite").

 

 

Switches

A switch is added to a command to modify the command's behavior.  Switches may be any (logical) combination of the following:

 

/keepalive  (or /a)

Keeps the RC-WinTrans server running after a command has been executed.  Without this switch the RC-WinTrans application will shut down once the command has been processed.

 

Use this switch for each command in a batch file except for the last one.  Without the "/keepalive" flag the RC-WinTrans server is closed after the command has been executed.

 


 

/log  (LogFileName)

The name of the text file (.txt, .log) to which processing output is to be written.  If the file doesn't exist then it will be created.  If the file does exist the processing data will be added to end of the file.

 


 

/macro  (VBAProjectName)

Specifies a VBA macro project where the command line dispatcher function ("CommandLine") is implemented to handle the current command.

 

VBAProjectName:  The name of the VBA project where the command line dispatcher function is implemented.

 

NOTE:  The project name "ExcelImportExportAddOnV3" must be used for this add-on's import/export commands (see the samples above).

 


 

/module  (VBAModuleName)

Specifies a VBA macro module where the command line dispatcher function ("CommandLine") is implemented to handle the current command.

 

Note that the command line tool ("rwtcmd.exe") always calls the function "DispatchCommand" within the specified module.

 

The synopsis is as follows:

Function DispatchCommand (ByRef Parameters() As Variant) As Long

 

The command line arguments are passed as a (zero-based) array of variants.

 

VBAModuleName:  The name of the VBA module where the command line dispatcher function is implemented.

 

NOTE:  The module name "CommandLine" must be used for this add-on's import/export commands (see the samples above).

 

 

File Names

File names (e.g., "ProjectFileName"; "SourceFileName"; "TargetFileName") may have complete or relative file paths, as in:

c:\trans\my.rwtproject

source.dll

...\target.dll

 

 

Return Values

A non-negative return value indicates a successful operation.

A negative return value always indicates an error.

 

^ TOP ^