send number to other application via shell object... strange behavior

Davide Favargiotti's icon

Hi to all
I'm trying to send numbers to other application (like TextEdit) with the shell object and applescript.
It's working: list of numbers in Max get "retyped" in TextEdit, but sometime (usually every 4 or 5 time) the order of those numbers it's all wrong Ex. if I have in max 1 2 3 4 5 6 7 8, i get in TextEdit 1 2 4 3 5 6 8 7.
In the max window the numbers are always printed in the right order, so I'm thinking that something get delayed in the applescript.

Max Patch
Copy patch and select New From Clipboard in Max.

(you need the shell object)

Do you have any advice?
thanks in advance

Davide

cap10subtext's icon

While I'm sure you may have your reasons for doing it like this, I recommend you build a parser that stores what you type and the performs actions in a proper loop. I recommend poly or at the very least store the i you are trying to send an only send it when the previous one has executed it's shell script successfully.

Davide Favargiotti's icon

You are perfectly right! ☺ I didn't patch the right output of the shell object (that bang after execution) to the next shell object... Too much patching late at night! ☺ now it works, I have to make it a little more efficient, as you say a loop is the best way to do do it. Have you any example of how can I use the poly as a parser?
Thank you
cheers
davide