On Wed, 29 Jul 2020 at 23:57, kmo <vox...@gmail.com> wrote:
>
> Let's see: 'a.bat 10' works but 'a.bat', myTextField asString does NOT work.
> There's clearly something wrong with 'a.bat', myTextField asString - but
> what? As Tim says, you have to investigate.
>
> Tim has suggested a couple of ways you could investigate. Here's another -
>
> You have my code that writes the stuff typed in to myTextField to the
> Transcript when you click the button. Did you get it working? Did you try it
> out? Are you happy you understood it? The Transcript is not perhaps the best
> way to debug but in this case you have it readily available.
>
> Amend that code so that it writes out 'a.bat', myTextField asString to the
> Transcript. Do you get what you expect? If not, why is that?
>
> When you see what you are getting it should give you a good clue as to what
> is wrong. Keep experimenting with the code until you get precisely what you
> want appearing in the Transcript. Then you can go back and change the code
> to use LibC

This is good advice, and to clarify further...

If this works...
    myButton whenActivatedDo: [LibC system: 'a.bat 10'].
and this doesn't...
   myButton whenActivatedDo: [LibC system: 'a.bat', myTextField asString].
and you can't see why, then you likely have an assumption about what
you think is happening, that is blinding you what is actually
happening, which you need to expose :)
i.e. you need to know *exactly* what string is being passed in the
#system: call.
One way to do that is to replace "LibC system:" with
"Transcript:show:" in your code.

cheers -ben.
myButton whenActivatedDo: [ Transcript show: myTextField text]

Reply via email to