如何在 4GL 中使用 INPUT/OUTPUT 运行 .exe/.bat 文件

时间:2021-03-01 09:20:17

标签: batch-file exe wkhtmltopdf openedge progress-4gl

我尝试通过 Progress4GL 中的 wkhtmltopdf.exe 创建 PDF 文件。我已经编写了一个下载 html 文件作为输入的程序。

procedure downloadhtml:

    define input parameter i-benutzer as character  no-undo.

    
    define variable zw-path         as character no-undo.
    define variable h-uhrzeit       as character no-undo.
    define variable h-text          as character no-undo.    
    

    h-uhrzeit = string(time, "HH:MM:SS").
    h-uhrzeit = replace(h-uhrzeit, ":", "."). 
   
    h-text = '<div style="color:red;">I am a html file</div>'.
   
    
    find database.table
         where database.table.man     = "xxx"
         and   database.table.krg     = "X-2540.w"
         and   database.table.user    = "_PPS"
         and   database.table.opzt    = "_PPN"
         no-lock no-error.
    if available database.table then do:
       zw-path = table.field.
    end.

 
    OUTPUT TO VALUE(zw-path + "Name_" + string(today,"99.99.9999") + "_" + h-uhrzeit + "_" + i-benutzer + ".html").
  
    
        put unformatted h-text skip.
   
    
    output close.

end procedure.

它将html文件下载到这个目录:

K:\K11\WEB\PDF\Name_01.03.2021_09.17.25_xx.html

wkthmltopdf.exe 有 1 个输入和 1 个输出目录。 CMD 控制台中的结构如下所示 --> :: [.exe] [INPUT DIRECTORY] [OUTPUT DIRECTORY]

如果我使用这些命令手动运行 cmd 控制台,它可以完美运行

cd C:\Program Files (x86)\wkhtmltopdf\
wkhtmltopdf.exe K:\K11\WEB\PDF\Name_01.03.2021_09.17.25_xx.html K:\K11\WEB\PDF\Name_01.03.2021_09.17.25_xx.pdf

我的问题是:如何使用动态(名称取决于日期和时间)INPUT OUTPUT Variables in Progress 运行 .exe 文件?

我发现了一个运行 .exe 文件的命令4GL

os-command(wkhtmltopdf.exe) 

但是如何将输入和输出变量/目录放入 progress4gl 中的 .exe 文件?

2 个答案:

答案 0 :(得分:2)

类似的东西

    OS-COMMAND VALUE (SUBSTITUTE ("cd C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe K:\K11\WEB\PDF\Name_&1.&2.&3.html",
                                  DAY (TODAY),
                                  MONTH (TODAY),
                                  YEAR (TODAY))) .
             

答案 1 :(得分:0)

很久很久没有进行任何 Progress,所以我不记得 os-command 是如何工作的,但我会尝试

os-command("C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe" K:\K11\WEB\PDF\Name_01.03.2021_09.17.25_xx.html K:\K11\WEB\PDF\Name_01.03.2021_09.17.25_xx.pdf)

理论:引用完整的可执行文件名称​​应该被解释为单个标记。 可能 ) 中的 x86) 需要用 ^ 转义,即。 x86^)

相关问题