Viz Trio 脚本(Script) 续篇-如何通过导入txt来自动生成串联单

来源:互联网 发布:波士顿矩阵分析 编辑:程序博客网 时间:2024/05/16 10:03
Dim fso,res,objdialogDim m,n,i,l,ti,j,tempDim strDim saveaspage1, readpage1, readpage2, readpage3, readpage4, readpage5readpage1="bt"saveaspage1=50000saveaspage2 = 60000readpage2 = "biaoti"Const ForReading = 1Set fso = CreateObject("Scripting.FileSystemObject")dim pathpath = "c:\news.txt"Set ti = fso.OpenTextFile(path,ForReading)While not ti.AtEndOfStream    str=ti.Readall    MyArray = Split(str, chr(10)+chr(13), -1, 1)    for i=0 to Ubound(MyArray)        MyArray1 = Split(MyArray(i), chr(13), -1, 1)        j=Ubound(MyArray1)        if j=1 then            Triocmd("page:read_template "+Cstr(readpage1))            TrioCmd("page:set_property " & 1 & " " & Myarray1(0))            TrioCmd("page:saveas " + Cstr(saveaspage1))            saveaspage1 = saveaspage1 + 10        elseif j=2 then           Triocmd("page:read_template "+Cstr(readpage2))            TrioCmd("page:set_property " & 1 & " " & Myarray1(1))            TrioCmd("page:set_property " & 2 & " " & Myarray1(0))            TrioCmd("page:saveas " + Cstr(saveaspage2))            saveaspage2 = saveaspage2 + 10        end if    nextwendti.closeset fso=nothingmsgbox "ok"

上面是一段自动生成串联单的代码,你可以把放到自定义的脚本中,通过热键进行触发,怎么设置请看下面的步骤:




要测试上面的脚本,你需要具备:

1. 有套trio系统。

2. 有个模板,模板的可以可替换项命名为1和2,可替换项是指controltext的field identifier,保存模板,命名为biaoti。

3. 导入模板到tiro中。

4. 最后你要有个new.txt放在c盘根目录。


备注:Trio script支持标准的VBScript,有什么不懂的可以先google一下,百度一下可能找不到你想要的答案。



原创粉丝点击