Skip to content

Commit 95020ab

Browse files
committed
Add docs for word_translator project
1 parent 6e2d0c1 commit 95020ab

6 files changed

Lines changed: 46 additions & 13 deletions

File tree

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Scripts are invoked by **Laserfiche Remote Agent** which is a service installed
77
## Prerequisites
88

99
- [Python 3.6 or later](https://www.python.org/downloads/)
10+
- If your windows login user is different than the user running the remote agent, you need to install Python for all users.
1011
- [Visual Studio Code v1.80 or later](https://code.visualstudio.com/download)
1112
- [A Laserfiche Cloud Account](https://www.laserfiche.com/signon/)
1213
- [Creating a Python Script Documentation](https://doc.laserfiche.com/laserfiche.documentation/en-us/Default.htm#../Subsystems/ProcessAutomation/Content/Resources/Rules/pythonscript.htm?TocPath=Process%2520Automation%257CRules%257CGetting%2520Started%2520With%2520Scripts%257C_____2)
@@ -29,9 +30,15 @@ This project is using a mono-repo structure with multiple packages. Please refer
2930
## Deployment
3031
- Copy the whole repo into the remote agent folder
3132
- e.g., `C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules`
32-
- Add the remote agent location into the **PYTHONPATH**
33-
```python
34-
import os
35-
os.environ['PYTHONPATH'] = r'C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules'
36-
```
33+
34+
- Add the destination folder into the **PYTHONPATH** environment variable
35+
- if your windows login user is different than the user running the remote agent, you need to add the environment variable to `System variables`.
36+
- ```python
37+
import os
38+
os.environ['PYTHONPATH'] = r'C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules'
39+
```
40+
3741
- Install dependencies: `pip install -r requirements.txt`
42+
- If your windows login user is different than the user running the remote agent, you need to make `pip install` to install dependencies for all the user.
43+
- e.g, `pip install --target="C:\Program Files\Python312\Lib\site-packages" -r requirements.txt`
44+
- Please update the `--target` based on your python installation folder.

doc/template/readme.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Laserfiche Python Rule script Template project
2+
23
This project is a template for creating a Laserfiche Python Rule script project. It contains a sample script that can be used as a starting point for creating your own script.
34

45
## Deploy script to your remote agent
5-
- Copy the whole repo into the remote agent folder
6-
- e.g., `C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules`
7-
- Add the remote agent location into the **PYTHONPATH**
8-
```python
9-
import os
10-
os.environ['PYTHONPATH'] = r'C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules'
11-
```
12-
6+
7+
Refer to the [Deployment](../../README.md#deployment) for details.
8+
139
## Configure and test this script rule in your Laserfiche Cloud Account -> Process Automation -> Rules
1410

1511
Create a new rule:

doc/word_translator/readme.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Laserfiche Python Rule script Word Translator project
2+
3+
This project is a sample script to show how to import 3rd party pip packages in a Laserfiche Python Rule script project.
4+
5+
## Deploy script to your remote agent
6+
Refer to the [Deployment](../../README.md#deployment) for details.
7+
8+
## Configure and test this script rule in your Laserfiche Cloud Account -> Process Automation -> Rules
9+
10+
Create a new rule:
11+
12+
- Select the script rule type: Python
13+
- Script location: `C:\Program Files\Laserfiche\Server\RemoteAgent\ScriptRunner\Python\lf-sample-python-script-rules\source\word_translator\launcher.py`
14+
- Input:
15+
- Sentence: the words to translate
16+
- fr: translate to French
17+
- Output:
18+
- translated: the translated words
19+
20+
![Script Rule Configuration](script-rule-configuration.png)
21+
22+
## Test the rule
23+
24+
Providing sentence and language code to be translated, this script would translate the sentence.
25+
![Script Test Inputs](script-test-inputs.png)
26+
27+
## Test script rule in a workflow
28+
29+
Run the workflow and verify the script translate the sentence
30+
![Workflow Script Rule Sample](workflow-script-rule-sample.png)
98.8 KB
Loading
131 KB
Loading
86.5 KB
Loading

0 commit comments

Comments
 (0)