proc my_getDirectory {} {
   set res ""
   set posx [expr [winfo rootx .] + 50]   
   set posy [expr [winfo screenheight . ] - [winfo rooty .] -400]   
   set fid [open "| notepad" r ]
   if ![ string length $fid ] {
    puts "cannot open directory selector"
    return ""
   }
   gets $fid res
   catch {close $fid} err
   return "OK"
 
}
entry .ent
button .bt1  -text click -borderwidth 1 -takefocus 0 -command {
 .ent delete 0 end
 .ent insert 0 [my_getDirectory]
}
pack .ent
pack .bt1
