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

Re: [Clip] Re: Totalling using clipboard

Expand Messages
  • hsavage
    ... dvdwriters12, A few questions. Do you want to select each number individually or a column of numbers? Are the numbers always in a column, as in the
    Message 1 of 10 , Oct 2, 2006
    • 0 Attachment
      dvdwriters12 wrote:
      > Thanks,
      >
      > I should have been more clear.
      >
      > Suppose I am working in another document and we have a price list:
      >
      > £521.12
      >
      > £100
      >
      > £37.02
      >
      > £912.11
      >
      > £0.99
      >
      > TOTAL = £
      >
      > etc.
      >
      > I want to copy each price into the clipboard and have notetab in the
      > background accumulate the value and return the result in the
      > clipboard, without me switching to notetab.
      >
      > Ive tried but I dont think its possible.

      dvdwriters12,

      A few questions.

      Do you want to select each number individually or a column of numbers?

      Are the numbers always in a column, as in the example?

      Are the numbers always at the left margin as in the example?

      Will the numbers always have the currency symbol included?

      Do you deal in other currencies other than pounds, if so, which?

      Possibly more questions later, depending on the answers to these.

      ºvº
      2006.10.02
      -Newspaper HeadLine...
      "British Union Finds Dwarfs in Short Supply"
      hrs ø hsavage@...
    • Don - HtmlFixIt.com
      = V5 MultiLine NoSorting TabWidth=30 H= ;About this library ; Clip by Don at htmlfixit dot com If you start this thing and then paste numbers to the
      Message 2 of 10 , Oct 2, 2006
      • 0 Attachment
        = V5 MultiLine NoSorting TabWidth=30

        H=";About this library"
        ; Clip by Don at htmlfixit dot com
        If you start this thing and then paste numbers to the clipboard, you'll
        get the total of those numbers back on the clipboard when you are done.

        If you copy something that is not a number, then you get the total of
        all copied numbers to the clipboard.

        The next time you copy a number, it will continue on fresh.

        H=";"


        H="Start"
        ;start fresh
        ^!ClearVariables
        ;Set initial values for main variables
        ^!Set %CheckClipboard%=True; %PasteInfo%=0
        ;If user does not want to create a new document, skip this procedure
        :SkipNewDoc
        ^!Prompt Number copy mode is now enabled to total all numbers copied,
        copy an non-number to have get the total to the clipboard.

        H="Stop"
        ;Stop checking the Windows Clipboard
        ^!Set %CheckClipboard%=False
        ^!Prompt Number capturing stopped. Double-click on the "Start" Clip if
        you want to continue

        H="_OnClipboardChange"
        ;If we are not supposed to check the Windows Clipboard, end this Clip
        ^!IfFalse ^%CheckClipboard% End
        ;If the size of the text in the Clipboard exceeds 255 characters, end
        this Clip (unlikely to be a number)
        ^!If ^$GetClipboardSize$ > 255 End
        ;Copy Clipboard text into a variable
        ^!Set %ClipboardText%=^$GetClipboard$
        ;if not number, prompt for whether to continue or end the clip
        ^!If "^$IsNumber("^%ClipboardText%")$" = "1" NUMBER ELSE TOTAL
        :NUMBER
        ;Play sound file if it exists
        ^!Sound ^$GetSoundPath$SayInfo.wav

        ;MESSAGE
        ^!Set %subtotal%=^$Calc(^%subtotal%+^%ClipboardText%)$
        ^!Set %PasteInfo%=0
        ;End the Clip
        ^!Goto End

        :TOTAL
        ^!SetClipboard ^%subtotal%
        ^!ClearVariable %subtotal%

        ;End the Clip
        ^!Goto End
      • Don - HtmlFixIt.com
        ... It just occurred to me, didn t we have a discussion a while back that you cannot trust isNumber? If so I may need to fine tune this thing a little. I
        Message 3 of 10 , Oct 3, 2006
        • 0 Attachment
          Don - HtmlFixIt.com wrote:
          > = V5 MultiLine NoSorting TabWidth=30
          >
          > H=";About this library"
          > ; Clip by Don at htmlfixit dot com
          > If you start this thing and then paste numbers to the clipboard, you'll
          > get the total of those numbers back on the clipboard when you are done.
          >
          > If you copy something that is not a number, then you get the total of
          > all copied numbers to the clipboard.
          >
          > The next time you copy a number, it will continue on fresh.
          >

          It just occurred to me, didn't we have a discussion a while back that
          you cannot trust isNumber? If so I may need to fine tune this thing a
          little. I could be off here, does anyone else remember that discussion?

          I didn't test my clip on anything but whole numbers.

          When I started this clip, one of the ones I was looking at to remember
          the onClipBoardChange bit was one I worked on in 2002. So I've seen a
          lot of clips and I forget more than I remember probably :-)
        • dvdwriters12
          ... remember ... a ... Thanks Don, Yeah as you say it doesnt work on fractional numbers, but otherwise it seems to work except it doesnt return the result in
          Message 4 of 10 , Oct 3, 2006
          • 0 Attachment
            >
            > I didn't test my clip on anything but whole numbers.
            >
            > When I started this clip, one of the ones I was looking at to
            remember
            > the onClipBoardChange bit was one I worked on in 2002. So I've seen
            a
            > lot of clips and I forget more than I remember probably :-)
            >


            Thanks Don,

            Yeah as you say it doesnt work on fractional numbers, but otherwise it
            seems to work except it doesnt return the result in the clipboard
            (which is easy enough to modify).
          • Don - HtmlFixIt.com
            ... I have the solution around here to get it to work on fractional numbers. I ll try to do that when I get a second. It should be putting the result on the
            Message 5 of 10 , Oct 3, 2006
            • 0 Attachment
              > Thanks Don,
              >
              > Yeah as you say it doesnt work on fractional numbers, but otherwise it
              > seems to work except it doesnt return the result in the clipboard
              > (which is easy enough to modify).

              I have the solution around here to get it to work on fractional numbers.
              I'll try to do that when I get a second.

              It should be putting the result on the clipboard. When you are done
              totaling copy a non-number and you should have the result on the clipboard.

              Try that again and let me know if it is working. If not, I'll have to
              revisit. I should add that I am working in 4.95 pro.
            Your message has been successfully submitted and would be delivered to recipients shortly.