ReadTxt » 历史记录 » 版本 4
yangdefeng, 2022-05-31 10:07
1 | 3 | yangdefeng | h4. _*%{color:green}readTxt%*_ |
---|---|---|---|
2 | |||
3 | 1 | machenhe | 读取文件内容到指定变量 |
4 | |||
5 | |||
6 | 标签:命令定义|readTxt |
||
7 | |||
8 | *格式* |
||
9 | |命令名 |参数1 |参数2 | |
||
10 | |readTxt |文件路径 |结果保存变量 | |
||
11 | |||
12 | *说明* |
||
13 | * 参数1: 读取文件路径 |
||
14 | 3 | yangdefeng | 路径需要基于..\Mir200\Envir |
15 | 1 | machenhe | %{color:lightGrey}举例 |
16 | 设定读取路径为 |
||
17 | 3 | yangdefeng | \testlist.txt |
18 | 1 | machenhe | 完整读取路径 |
19 | 3 | yangdefeng | ..\Mir200\Envir\testlist.txt% |
20 | 1 | machenhe | |
21 | * 参数2: 指定返回变量 |
||
22 | |||
23 | - |
||
24 | - |
||
25 | |||
26 | 3 | yangdefeng | h4. *%{color:deepskyblue}特戒引擎脚本示例:%* |
27 | 1 | machenhe | |
28 | bq. 预制数据文件 |
||
29 | 3 | yangdefeng | ..\Mir200\Envir\数据文件\测试数据文件.txt |
30 | 1 | machenhe | --文件内容如下-- |
31 | |
||
32 | 测试数据1 |
||
33 | 测试数据2 |
||
34 | 测试数据3 |
||
35 | 测试数据4 |
||
36 | 测试数据5 |
||
37 | |||
38 | |
||
39 | |||
40 | bq. [@main] |
||
41 | #act |
||
42 | 3 | yangdefeng | mov s$file \数据文件\测试数据文件.txt |
43 | 4 | yangdefeng | *{color:green}readTxt* <$str(s$file)> s0 |
44 | 3 | yangdefeng | %{color:lightGrey};--print命令在控制台输出文件内容% |
45 | 1 | machenhe | print s0 |