Skip to main content

Powershell Scripts

You can develop Powershell Scripts that are executed by the Beebox each time a new source file is processed or a translated files are created.

Powershell scripting lets you:

  • Transfer translated files to other locations or a content management system
  • Identify erroneous source files and maintain your own logs or alerts
  • Identify target files that could not be created due to incorrect translations (e.g. invalid markup)

Adding Powershell scripts

Powershell scripts are enabled per Beebox project. This is done from the project settings page. Select a project, then click "Settings" and go to the "Automation" tab:

The script must be named and saved to the exact location printed.

Script location and parameters

The Powershell script name and location is preset by the system and specific to each project. You must save your script to this exact location.

{project base directory}\scripts\script-actions-files.ps1

 

The Powershell script is called with the parameters listed below.

>script-actions-files.ps1 -log {log path} -project {project id}

Parameters:

  • log: The path of the file containing all file operations since the last script execution (the File Actions Log).
  • project: The project id. This information is included for information purposes.
 

Log file format

The Beebox logs operations on both source files and target files. Source file operations refer to verification of file format and the extraction of text contents. Target file operations refer to the creation of the final or preliminary (MT) translated files. These operations can run both automatically (see the various Automation options) or be triggered from the Beebox user interface. Whenever a file operation fails, the log includes a detailed error description. If automated, the system will retry failed operations in regular intervals.

Read the detailed description of the log file

 

Typical lines may look like this:

CODE
2014-09-30T15:04:49.3653064+02:00|SOURCE|FAILED|en|c:\\beebox\\93f522ff-74e7-4522-a886-8af737082059\\in\\R-GeneralText - Copie.xliff||Failed to extract texts from source file.|Exception: The Xliff file contains languages other than the Beebox project languages\r\n at Wordbee.Beebox.Core.ProjectBuilder\r\n 
2014-09-30T15:04:49.5684508+02:00|TARGET|OK|fr|c:\\beebox\\93f522ff-74e7-4522-a886-8af737082059\\in\\R-Cautions.htm|c:\\beebox\\93f522ff-74e7-4522-a886-8af737082059\\out\\fr\\R-Cautions.prelim.htm|| 
2014-09-30T15:04:49.7075493+02:00|TARGET|OK|es|c:\\beebox\\93f522ff-74e7-4522-a886-8af737082059\\in\\R-Cautions.htm|c:\\beebox\\93f522ff-74e7-4522-a886-8af737082059\\out\\es\\R-Cautions.prelim.htm||

 

The fields are:

  • Field 1: The ISO formatted date when this line was written.
  • Field 2: "SOURCE" if the operation refers to the analysis of a source file, "TARGET" if it refers to the creation of a translated file.
  • Field 3: Status of operation. Either "OK" or "FAILED".
  • Field 4: The language code of the file. If the line is for a source file then this always is the project source language.
  • Field 5: The full path of the source file.
  • Field 6: The full path of the translated file. Empty if the operation refers to the analysis of a source file.
  • Field 7: Error message, if operation failed.
  • Field 8: Full error details, if operation failed. This information is typically very technical.

 

Testing a script

To test your script you will need sample log files. The good news is that all file operations in a project are logged in the exact same format as described above.

The log file can be found at:

{project base directory}\temp\actions-files.log

By the way, when your script is executed it is passed a copy of this file. Upon completion, the original log file is deleted. This simple mechanism ensures that you always receive those changes that you did not yet process. If you would like to keep all historical events, your script can copy the log to a different location.

 

Additional information

Execution frequency: The script is executed in intervals configured in the "Automation" tab of the project settings (it shares the same interval as the other automatic operations). The script is executed only if there are any new file related events since the last run.

Security: The script will be run by the Beebox Windows service "Wordbee Beebox Service" and runs under the account assigned to that service. If your script requires access to specific network resources, you need to elevate the rights of the service account.

Blocking behavior: The Beebox waits until the script terminates. Until then users are blocked from login to the web UI or the API. You should make sure that the script runs quickly and does not "hang". For long running operations it is recommended to spawn another script or executable and return immediately. In the case your script "hangs" you will have to restart the Wordbee Beebox Windows service in order to kill the process.

Disabled user interface: The Powershell window is hidden during execution. It is also not possible to await user input (should not be done anyway with automated scripts).

 

 

 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.