Loading ...
Sorry, an error occurred while loading the content.

Re: Precluding Negative Values [was: Countdown Timer: Days, Hours...]

Expand Messages
  • thricipio
    ... Sorry about any confusion with my abbreviations: ƒ.ABS is my own short form for the ABS function. Likewise: ƒ.ASSIGN, etc. I think you re using
    Message 1 of 28 , Jul 1, 2007
    View Source
    • 0 Attachment
      --- In power-pro@yahoogroups.com, no spam <nospam0123456us@...> wrote:
      >
      > it seem that ABS is not found ==> verify that yiu use
      > .ABS if it is a script ! an other solution is to use 2
      > variables !
      > *info expr ( assign("totalsec", date.subseconds(20060101,
      > date.now))/(24*3600) ++ ":" ++ assign("totalsecabs", ifelse
      > (totalsec<0,totalsec * -1,totalsec))%
      > (24*3600)/3600++":"++totalsecabs%3600/60++":"++
      > totalsecabs%60)
      >
      > Hope this help !

      Sorry about any confusion with my abbreviations: "ƒ.ABS" is my own
      short form for "the ABS function." Likewise: "ƒ.ASSIGN," etc. I
      think you're using the gmane.org mirror site, which apparently
      doesn't translate some extended characters (e.g., ƒ).

      Anyway, thanks for the reply... but... it seems like the above code
      would just accomplish the same end result as simply using ABS within
      the original assign statement... which is *not* what I'm looking for.

      But again, thanks for the response.
      ________
      —Thri
      ¯¯¯¯¯¯¯¯
    • brucexs
      ... Its difficult to debug complex expressions in *info, so I would first get it working in a script. If the error message there is still too hard to pin down,
      Message 2 of 28 , Jul 1, 2007
      View Source
      • 0 Attachment
        > However, when I code & test this, it doesn't work; i.e., the
        > resulting *info bar seems to contain the entire code text. I can't
        > figure out why it's failing.
        >
        > Here's the code in both readable and usable format:
        > http://tinyurl.com/3aafgk
        >

        Its difficult to debug complex expressions in *info, so I would first
        get it working in a script.

        If the error message there is still too hard to pin down, try splitting
        the expression into pieces, maybe
        locap part1 =
        local part2 =
        local result =
        till you isolate the error.

        Also note that PowerPro expressions (and statements) cannot be longer
        than abou 512 characters: you will get cryptic error messages if they
        are.

        YOu can rename the variable to shorten. Or try something like
        calculating and assigning the expression to a variables, if-else just
        to test sign and produce either "-" or "", then ++ rest of expression
        (so you do not have to repeat formatting).
      • Sheri
        ... I thought the magic number was 530? Regards, Sheri
        Message 3 of 28 , Jul 1, 2007
        View Source
        • 0 Attachment
          --- In power-pro@yahoogroups.com, "brucexs" <bswitzer@...> wrote:
          >
          >
          > Also note that PowerPro expressions (and statements) cannot be longer
          > than abou 512 characters: you will get cryptic error messages if they
          > are.

          I thought the magic number was 530?

          Regards,
          Sheri
        • thricipio
          ... Bruce, thanks for the reply. Just to be clear (clarity for *me*, that is)... An expression cannot have more than one (however complex) discrete statement,
          Message 4 of 28 , Jul 1, 2007
          View Source
          • 0 Attachment
            --- In power-pro@yahoogroups.com, "brucexs" <bswitzer@...> wrote:
            > You can rename the variable to shorten. Or try something like
            > calculating and assigning the expression to a variables, if-else just
            > to test sign and produce either "-" or "", then ++ rest of expression
            > (so you do not have to repeat formatting).

            Bruce, thanks for the reply.

            Just to be clear (clarity for *me*, that is)...

            An expression cannot have more than one (however complex) discrete
            statement, right?
            ________
            —Thri
            ¯¯¯¯¯¯¯¯
          • thricipio
            ... Me, I m still largely clueless about the finer (and not so fine) points of using expressions. But, one might expect 512 to be more likely, since it s a
            Message 5 of 28 , Jul 1, 2007
            View Source
            • 0 Attachment
              --- In power-pro@yahoogroups.com, "Sheri" <sherip99@...> wrote:
              > I thought the magic number was 530?

              Me, I'm still largely clueless about the finer (and not so fine) points
              of using expressions. But, one might expect 512 to be more likely,
              since it's a power of 2. But... what do I know? Astonishingly little
              after all these years as PPro user.
              ________
              —Thri
              ¯¯¯¯¯¯¯¯
            • thricipio
              ... Bruce- Thanks for the additional tips. I ve gotten this working now. Turns out the problem was the expression s length afterall. My testing yielded
              Message 6 of 28 , Jul 1, 2007
              View Source
              • 0 Attachment
                --- In power-pro@yahoogroups.com, "brucexs" <bswitzer@...> wrote:
                > Also note that PowerPro expressions (and statements) cannot be
                > longer than abou 512 characters: you will get cryptic error
                > messages if they are.
                >
                > You can rename the variable to shorten. Or try something like
                > calculating and assigning the expression to a variables, if-else
                > just to test sign and produce either "-" or "", then ++ rest of
                > expression (so you do not have to repeat formatting).

                Bruce-

                Thanks for the additional tips. I've gotten this working now. Turns
                out the problem was the expression's length afterall. My testing
                yielded failure (with the entire expression string showing up in the
                *info bar) for expression lengths greater than 260.

                The results of my efforts, with your help are viewable here:
                http://tinyurl.com/289dkm

                Thanks again for all the help.
                ________
                —Thri
                ¯¯¯¯¯¯¯¯
              • brucexs
                ... Yes, it is around 530; I said 512 to give a safety factor. An expression is an alternating series of values and operators, grouped by balanced parentheses.
                Message 7 of 28 , Jul 1, 2007
                View Source
                • 0 Attachment
                  --- In power-pro@yahoogroups.com, "thricipio" <thricipio@...> wrote:
                  >
                  > --- In power-pro@yahoogroups.com, "Sheri" <sherip99@> wrote:
                  > > I thought the magic number was 530?

                  Yes, it is around 530; I said 512 to give a safety factor.

                  An expression is an alternating series of values and operators, grouped
                  by balanced parentheses. See help on expressions for details.

                  A statement is anything that can stand alone as a script line.

                  In most languages that still distinguish the two, any expression is
                  usually allowable also as a statement, although PowerPro is fussier.
                  It permits function or plugin call expressions as statements, but not
                  arbitrary expressions.
                • thricipio
                  ... A little more effort on my part has shown me that quite a lot can be accomplished with the concatenation operand, ++ ! Cool!! ________ —Thri
                  Message 8 of 28 , Jul 1, 2007
                  View Source
                  • 0 Attachment
                    --- In power-pro@yahoogroups.com, "thricipio" <thricipio@...> wrote:
                    > An expression cannot have more than one (however complex) discrete
                    > statement, right?

                    A little more effort on my part has shown me that quite a lot can be
                    accomplished with the concatenation operand, "++" ! Cool!!
                    ________
                    —Thri
                    ¯¯¯¯¯¯¯¯
                  • thricipio
                    ... I have no doubt about what you say, but it *does* make me curious about why the expression I ve composed fails at length 260. ________ —Thri
                    Message 9 of 28 , Jul 1, 2007
                    View Source
                    • 0 Attachment
                      --- In power-pro@yahoogroups.com, "brucexs" <bswitzer@...> wrote:
                      > --- In power-pro@yahoogroups.com, "Sheri" <sherip99@> wrote:
                      > > I thought the magic number was 530?
                      >
                      > Yes, it is around 530; I said 512 to give a safety factor.

                      I have no doubt about what you say, but it *does* make me curious about
                      why the expression I've composed fails at length > 260.
                      ________
                      —Thri
                      ¯¯¯¯¯¯¯¯
                    • thricipio
                      ... Now I find myself wondering if there s a way to output the results of an expression into a text field... like into a PowerPro Note... or into an e-mail.
                      Message 10 of 28 , Jul 1, 2007
                      View Source
                      • 0 Attachment
                        > Bruce-
                        >
                        > Thanks for the additional tips. I've gotten this working now.
                        > Turns out the problem was the expression's length afterall.

                        Now I find myself wondering if there's a way to output the results of
                        an expression into a text field... like into a PowerPro Note... or into
                        an e-mail. I'm guessing PowerPro can handle this but I don't have a
                        clue as to how to go about it. Ideally, I'd like to hit a key series
                        or combination that would write something like the following:
                        "<DD> days, <hh> hours and <mm> minutes until the new drapes arrive!"

                        If anyone has any hints or suggestions, I'd be most appreciative.

                        Thanks.
                        ________
                        —Thri
                        ¯¯¯¯¯¯¯¯
                      • Sheri
                        ... You could easily set up a hotkey (Configure Key/Mouse) that works in your email program or all the time, that puts the phrase on the clipboard. The command
                        Message 11 of 28 , Jul 1, 2007
                        View Source
                        • 0 Attachment
                          --- In power-pro@yahoogroups.com, "thricipio" <thricipio@...> wrote:

                          > Now I find myself wondering if there's a way to output the
                          > results of an expression into a text field... like into a
                          > PowerPro Note... or into an e-mail. I'm guessing PowerPro can
                          > handle this but I don't have a clue as to how to go about it.
                          > Ideally, I'd like to hit a key series or combination that would
                          > write something like the following: "<DD> days, <hh> hours and
                          > <mm> minutes until the new drapes arrive!"
                          >
                          > If anyone has any hints or suggestions, I'd be most appreciative.
                          >

                          You could easily set up a hotkey (Configure Key/Mouse) that works in
                          your email program or all the time, that puts the phrase on the clipboard.

                          The command block would be something like:

                          clip.set(.countdown("20070704200000")++ " until Independence Day
                          fireworks!")

                          You could add "more commands" to also paste into the current window.

                          e.g., in more commands:

                          wait.for(50)
                          clip.paste

                          Regards,
                          Sheri
                        • thricipio
                          ... Sheri, this looks great. I ll give it a go and let you know how it works out. Many thanks! ________ —Thri ¯¯¯¯¯¯¯¯
                          Message 12 of 28 , Jul 1, 2007
                          View Source
                          • 0 Attachment
                            --- In power-pro@yahoogroups.com, "Sheri" <sherip99@...> wrote:
                            > You could easily set up a hotkey (Configure Key/Mouse) that works in
                            > your email program or all the time, that puts the phrase on the
                            > clipboard.
                            >
                            > The command block would be something like:
                            >
                            > clip.set(.countdown("20070704200000")++ " until Independence Day
                            > fireworks!")
                            >
                            > You could add "more commands" to also paste into the current window.
                            >
                            > e.g., in more commands:
                            >
                            > wait.for(50)
                            > clip.paste

                            Sheri, this looks great. I'll give it a go and let you know how it
                            works out. Many thanks!
                            ________
                            —Thri
                            ¯¯¯¯¯¯¯¯
                          • thricipio
                            ... Sheri- Upon further reflection, I remembered that I use a *Keys command to write a date and time stamp to text fields. I adopted my previous code by
                            Message 13 of 28 , Jul 1, 2007
                            View Source
                            • 0 Attachment
                              --- In power-pro@yahoogroups.com, "Sheri" <sherip99@...> wrote:
                              > You could easily set up a hotkey (Configure Key/Mouse) that works
                              > in your email program or all the time, that puts the phrase on the
                              > clipboard.
                              >
                              > The command block would be something like:
                              >
                              > clip.set(.countdown("20070704200000")++ " until Independence Day
                              > fireworks!")

                              Sheri-

                              Upon further reflection, I remembered that I use a *Keys command to
                              write a date and time stamp to text fields. I adopted my previous code
                              by essentially substituting *Keys for *Info and "!" for "expr".

                              Yours was also a good approach and I appreciate the response. It
                              reminds me there's usually more than one good PPro way to meet a
                              variety of needs.

                              Thanks again.
                              ________
                              —Thri
                              ¯¯¯¯¯¯¯¯
                            • brucexs
                              ... code ... I think you mean keys &(expr) But win.keys(expr) is more reliable. Help, index, expressions - using in commands.
                              Message 14 of 28 , Jul 2, 2007
                              View Source
                              • 0 Attachment
                                > write a date and time stamp to text fields. I adopted my previous
                                code
                                > by essentially substituting *Keys for *Info and "!" for "expr".
                                >
                                >
                                I think you mean
                                keys &(expr)

                                But
                                win.keys(expr)
                                is more reliable. Help, index, expressions - using in commands.
                              • thricipio
                                ... Well, I should have probably said & , but I use ! instead (defined under advanced setup). ... Thanks for the suggestion. I ve incorporated the change
                                Message 15 of 28 , Jul 2, 2007
                                View Source
                                • 0 Attachment
                                  --- In power-pro@yahoogroups.com, "brucexs" <bswitzer@...> wrote:
                                  > I think you mean
                                  > keys &(expr)

                                  Well, I should have probably said "&", but I use "!" instead (defined
                                  under advanced setup).

                                  > But win.keys(expr) is more reliable.
                                  > Help, index, expressions - using in commands.

                                  Thanks for the suggestion. I've incorporated the change into my
                                  latest script which I've decided to go with intead of an expression
                                  so I could format the text in a more user-friendly way.

                                  It can be found here:
                                  http://tinyurl.com/3247bf

                                  Thanks again for all the help.
                                  ________
                                  —Thri
                                  ¯¯¯¯¯¯¯¯
                                Your message has been successfully submitted and would be delivered to recipients shortly.