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

15583Re: [Clip] Re: Totalling using clipboard

Expand Messages
  • Don - HtmlFixIt.com
    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
    • Show all 10 messages in this topic