Luc
2024-12-17 04:37:49 UTC
Howdy. I have this pop-up dialog that prompts for two pieces of
information: a name (arbitrary string) and a button that will
invoke a file browser so the user can select a file. Then:
bind $::SRw <Return> {set ::PINPUT "$pname|$pfile"}
then:
vwait ::PINPUT
catch {destroy $::SRw}
return $::PINPUT
It works.
But then I use the ::PINPUT variable, splitting it on the pipe |
symbol to identify the two pieces of information. And then I think,
what if the user uses the pipe symbol in $name?
OK, how about this:
bind $::SRw <Return> {set ::PINPUT "$pname::::::::::::::::$pfile"}
And then I think, what if the user's cat walks on the keyboard and
the user actually enters that kind of string?
OK, how about this:
bind $::SRw <Return> {set ::PINPUT "$pname|=MagicSeparator=|$pfile"}
And then I think, what if the user is possessed by Satan and actually
uses that Magic Separator in $name?
As unlikely as that is, I ask of you: what is the wise, serious,
professional way of handling that situation and making sure that
worse things won't happen at sea?
information: a name (arbitrary string) and a button that will
invoke a file browser so the user can select a file. Then:
bind $::SRw <Return> {set ::PINPUT "$pname|$pfile"}
then:
vwait ::PINPUT
catch {destroy $::SRw}
return $::PINPUT
It works.
But then I use the ::PINPUT variable, splitting it on the pipe |
symbol to identify the two pieces of information. And then I think,
what if the user uses the pipe symbol in $name?
OK, how about this:
bind $::SRw <Return> {set ::PINPUT "$pname::::::::::::::::$pfile"}
And then I think, what if the user's cat walks on the keyboard and
the user actually enters that kind of string?
OK, how about this:
bind $::SRw <Return> {set ::PINPUT "$pname|=MagicSeparator=|$pfile"}
And then I think, what if the user is possessed by Satan and actually
uses that Magic Separator in $name?
As unlikely as that is, I ask of you: what is the wise, serious,
professional way of handling that situation and making sure that
worse things won't happen at sea?
--
Luc
Luc