1

After recording in RCPTT, I have the following script:

get-editor "test.c" | get-text-viewer | get-property "markers['31'][0].Type" 
| equals "text-to-verify" | verify-true

markers['31'][0].Type has value from markers['0'][0].Type - markers['45'][0].Type and the numbers are dynamic.

I want to check that any of marker type contain the specific value or not.

But I can't by using .* or foreach.

How can I solve this problem?

Lii
  • 11,553
  • 8
  • 64
  • 88
Eric Ipsum
  • 723
  • 3
  • 10
  • 24

1 Answers1

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
        }
    }
}
Adam Horvath
  • 1,249
  • 1
  • 10
  • 25
  • the problem is while executing first time, numbers are 1, 32 and 45 but while executing second time, the numbers are changed and as it can not find the item, it actually fails. so i want to iterate over each item to check that item exist or not. – Eric Ipsum May 10 '18 at 19:19
  • or it would also be better for me how to check the existance of a property. i am using //get-editor "w.c" | get-text-viewer | get-property "markers['31'][0].Type" |get "false" | equals "false" | verify-true // | equals | verify-true but not working – Eric Ipsum May 10 '18 at 20:05