在RCPTT中录制后,我有以下脚本:
get-editor "test.c" | get-text-viewer | get-property "markers['31'][0].Type"
| equals "text-to-verify" | verify-true
markers['31'][0].Type
的价值来自markers['0'][0].Type
- markers['45'][0].Type
,数字是动态的。
我想检查任何标记类型是否包含特定值。
但我无法使用.*
或foreach
。
我该如何解决这个问题?
答案 0 :(得分:1)
// This will store the comma separated list
global [val indices 0]
// Set to expected size of indices (10)
global [val list_size [int 10]]
loop [val index [int 1]] {
global [val indices [concat $indices "," $index]] -override
if [$index | lt $list_size] {
recur [$index | plus 1]
}
}
$indices | split -sep "," | foreach [val item] {
with [get-editor "test.c" | get-text-viewer] {
try {
get-property [concat "markers['" $item "'][0].Type"]
| equals "text-to-verify" | verify-true
}
-catch {
// You will need to fine-tune this catch to not allow every sort of problems
}
}
}