问题
I am facing an issue about passing ecl command as procedure input.
I have an ecl command:
get-editor [format "Configuration Editor - %s" $projNmae] | click
I want to take this ecl command as parameter input in a procedure. What i am doing is:
proc "wait-until-element-is-loaded" [val editor] {
loop [val count 0] {
try {
$editor | click
} -catch {
if [eq $count 4] {
// 30 seconds
throw-error [concat "element can not be loaded within the wait time. " $editor]
}
wait 100
recur [$count | plus 1]
}
}
}
Then calling the procedure like:
wait-until-element-is-loaded | get-editor [format "Configuration Editor - %s" $projName]
or
wait-until-element-is-loaded -editor get-editor [format "Configuration Editor - %s" $projName]
But its not working. I want to do this as i want to pass different parameter at different times while executing.
Thanks
回答1:
I don't think you pass a Widget to a user-written procedure.
I remember trying it once, and it didn't work for me too.
Convert your wait-until-element-is-loaded
to receive a string and call get-editor
inside it.
来源:https://stackoverflow.com/questions/51271324/use-ecl-command-as-proc-parameter-input