Reputation: 171
I am using twapi 4.1 version to get the details of a printer ("myprinter). Below command works and gives me expected results.
set printerData [twapi::recordarray getlist [twapi::enumerate_printers] -filter {{-name eq myprinter -nocase}}]
However, I cannot pass the printer name as an argument to -filter option.
Below code doesn't work:
set printerName "myprinter"
set printerData [twapi::recordarray getlist [twapi::enumerate_printers] -filter {{-name eq $printerName -nocase}}]
I tried different formats (using subst command and all) but nothing worked.
Any idea how can I pass the printer name as an argument? Thanks in advance for your help.
--Nik
Upvotes: 0
Views: 123
Reputation: 3003
The problem is that tcl doesn't evaluate the string inside curly braces, so you should change your code using the list command instead:
set printerName "myprinter"
set printerData [twapi::recordarray getlist \
[twapi::enumerate_printers] \
-filter [list [list -name eq $printerName -nocase ] ]\
]
Upvotes: 1