newline with post()


    Mar 16 2007 | 11:34 am
    Hi,
    From the manual it's clear that printing a new line in the max window can be done by calling the post() method without arguments.
    It looks as if lines printed with the [print] object always have a line break after their content, but also before their content if the previous line was from the post() command.
    Thus both the newline post() done before a [print] and a newline post() done after a [print] always result in an empty line. I hope I am clear, my english isn't really sufficient.
    Is there a way to avoid this?
    Regards,
    Mattijs

    • Mar 17 2007 | 11:38 pm
      Allright, sorry ;) Here is an example:
      --- save as printjs.js
      autowatch = 1;
      function printjs(v)
      {
      post(v);
      post();
      }
      Mattijs
    • Mar 22 2007 | 5:35 pm
      try:
      post("nmymessage"1,2,3);
      or try
      post("mymessage",1,2,3,"n");
      the "" alerts the system that the "n" means "newline". Similar is "t" for tab.
      I prefer the "nmessage" as it's easier to type than "n" at the end of every post()!
      P
    • Mar 22 2007 | 6:57 pm
      Quote: pnyboer wrote on Thu, 22 March 2007 18:35
      ----------------------------------------------------
      > try:
      > post("nmymessage"1,2,3);
      >
      > or try
      > post("mymessage",1,2,3,"n");
      >
      > the "" alerts the system that the "n" means "newline". Similar is "t" for tab.
      > I prefer the "nmessage" as it's easier to type than "n" at the end of every post()!
      >
      > P
      ----------------------------------------------------
      Hi mr. Nyboer, thanks for your reply.
      I know about the newline command but it has the same problem. You could try in the patch I posted. I think the problem simply is that there is an automatic newline when switching from javascript output to max output.
      Cheers,
      Mattijs
    • Mar 26 2007 | 12:39 am
      Quote: Mattijs wrote on Fri, 23 March 2007 06:57
      ----------------------------------------------------
      I think the problem simply is that there is an automatic newline when switching from javascript output to max output.
      ----------------------------------------------------
      Seems so. It's mildly annoying, and tends to force me to use one or the other, but not both. Also seems that subsequent post() calls will generate an unasked-for newline if any non-js processing has occurred in between, even without [print] output? Meh.
    • Mar 26 2007 | 9:42 am
      Quote: johnpitcairn wrote on Mon, 26 March 2007 02:39
      ----------------------------------------------------
      > Quote: Mattijs wrote on Fri, 23 March 2007 06:57
      > ----------------------------------------------------
      > I think the problem simply is that there is an automatic newline when switching from javascript output to max output.
      > ----------------------------------------------------
      >
      > Seems so. It's mildly annoying, and tends to force me to use one or the other, but not both. Also seems that subsequent post() calls will generate an unasked-for newline if any non-js processing has occurred in between, even without [print] output? Meh.
      >
      ----------------------------------------------------
      Exactly.
      Ok, this is a bugreport/feature request as far as I'm concerned.
      Regards,
      Mattijs