将字符串数组传递到批处理模式[门9.6]的DXL脚本

发布于 2025-02-06 06:55:41 字数 1396 浏览 0 评论 0原文

目的:

  • 我需要将字符串(或对象标识符或整数..)的数组传递到批处理模式下的DXL脚本。

问题:

  • 传递数组参数时,cmd提示符弹出,这意味着发生了错误(目前没有stderr重定向)

  • 使用int array时的完整命令如下:

    r'“ C:\ Program Files \ ibm \ rational \ Doors \ Doors \ 9.6 \ bin \ Doors” -d [email  procearted] -u user -p passw -p pastw -p prj -dxl“ int reqname [int reqname [] “ testplanned {} \”;字符串结果= \“ testResult {} \” - batch“ script.dxl”> D:\ output.txt'

  • 使用.format {}在python中填充脚本,然后使用subprocess.check_output启动。为了测试它,足以启动从命令线上启动命令:

    r'“ C:\ Program Files \ ibm \ rational \ Doors \ Doors \ 9.6 \ bin \ Doors” -d [email  preatected] -u user -p passw -p passw -p prj -dxl“ int reqname [int reqname [] “测试计划1 \”;字符串结果= \“ testResult 1 \”“ -batch” script.dxl”> D:\ output.txt'

作为附带注意,d:\ output.txt是从未创建或填充,所以也许我在这里也缺少一些东西。

脚本实际上只是打印(couts)接收到的参数的值或大小:

cout<< planned "\r\n"
cout<< result "\r\n"
print sizeof(reqName)"" 

The goal:

  • I need to pass an array of strings (or object identifiers, or integers..) to a dxl script in batch mode.

The issue:

  • When passing the array parameter, the cmd prompt pops up, meaning that an error happened (no stderr redirect for the moment)

How am I doing:

  • the full command when using an int array is the following:

    r'"C:\Program Files\IBM\Rational\DOORS\9.6\bin\doors" -d [email protected] -u user -P passw -p PRJ -dxl "int reqName[]={{1,2,3,4}}; string planned=\"TestPlanned {}\"; string result=\"TestResult {}\" " -batch "script.dxl" > D:\output.txt'

  • the script is populated in python using .format{} and then launched using subprocess.check_output. In order to test it, it's sufficient to launch the command fromcommand line placing like this:

    r'"C:\Program Files\IBM\Rational\DOORS\9.6\bin\doors" -d [email protected] -u user -P passw -p PRJ -dxl "int reqName[]={{1,2,3,4}}; string planned=\"TestPlanned 1\"; string result=\"TestResult 1\" " -batch "script.dxl" > D:\output.txt'

as a side note, the D:\output.txt is never created or populated, so maybe I am missing something also here.

The script actually just prints (couts) the value or the size of the params received:

cout<< planned "\r\n"
cout<< result "\r\n"
print sizeof(reqName)"" 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

临风闻羌笛 2025-02-13 06:55:41

我认为这不会像书写一样起作用 - “ script.dxl”正在与您要求在命令行上运行的-dxl的单独上下文中评估。

另外,DXL不使用;作为终点线,因此您可能需要一般查看您的语法。

选项:

  1. 您可以在-dxl中使用astap_,类似-dxl“ evaltop _(\” int reqname [] = {1,2,3,4} \“”,它将将变量重新定为门的全局上下文。只要对这些,请非常小心,因为任何其他呼叫重新名称的脚本都会获得此变量和键入,因此您应该更具体地
  2. 跳过-dxl,并使您的python重写脚本 。能够像.txt文件一样处理.dxl文件,但是如果需要,我猜您的python脚本可以写入txt,然后复制到DXL

。在选项1中

I don't think this will work as written- the 'script.dxl' is being evaluated in a separate context from the -dxl that you're asking the item to run on the command line.

Also, dxl doesn't use ; as end lines, so you might want to review your syntax generally.

Options:

  1. You could use evalTop_ in the -dxl, something like -dxl "evalTop_(\"int reqName[]={1,2,3,4}\"" which will shove a variable reqName into the global context of DOORS. Just be super careful with these, as any other script calling reqName will get this variable and type, so you should make the name significantly more specific.
  2. Skip the -dxl and have your python re-write some part of script.dxl - you should be able to treat .dxl files like .txt files generally, but if needed I guess your python script could just write to txt and then copy over onto a dxl.

Let me know if I've misunderstood something!

Note- edited to escape backslashes in option 1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文