I'm having troubles getting some parts out of a string.
Here is my code :
set top [layout peek $::openedFiles($key) -topcell]
set dim [layout peek $::openedFiles($key) -bbox $top]
# yields output "{name{x1 y1 x2 y2}}"
set coord [split $dim " "]
set x1 [lindex $coord 0]
set x2 [lindex $coord 2]
set y1 [lindex $coord 1]
set y2 [lindex $coord 3]
When I call the command set dim [layout peek $::openedFiles($key) -bbox $top]
, I get the dimensions back from the loaded file. These dimension are coordinates. The output is always like this: "{name {x1 y1 x2 y2}}"
.
For example : {test {0 0 100 100}}
I want to get the four coordinates out of the string so I can place them in an array.
I tried splitting the string based on a space, but without success. (keep getting this error: can't read "coord\{clock \{0 0 99960 99960\}\}": no such variable
)
Anybody got some thougths?