Search Clipboard For Specific Text and Extract To Clipboard


#1

Trying to figure this one out but can’t come up with a workflow.

  1. Select text and copy it to clipboard.
  2. Use RegExt to search for \d/\d\s-\s\D+\d+,\s\d+
  3. Paste all instances of RegExt results in a list.

Need this to extract sessions dates from my notes with clients.


#2

Having some sample data to test this with would be helpful, but generally speaking, you should be able to accomplish this by using For Each to append each match found to a variable, then paste the variable:

Search Clipboard For Specific Text and Extract To Clipboard.kmmacros (6.2 KB)


#3

I am trying to paste just the date without the session number int o a numbers table.

* 1/8 - September 28, 2018
* 2/8 - October 12, 2018
* 3/8 - October 26, 2018
* 4/8 - November 9, 2018
* 5/8 - November 23, 2018
* 6/8 - December 5, 2018
* 7/8 - December 17, 2018
* 8/8 - January 8, 2019

I need each date "September 28, 2018" to be pasted into a new line in Numbers.


#4

Here is an example macro to get you started.
You may need to modify to meet your exact workflow.

Example Macro Process

MACRO:   Extract Date and Paste into Apple Numbers @RegEx [Example]

~~~ VER: 1.0    2019-01-18 ~~~

DOWNLOAD:

Extract Date and Paste into Apple Numbers @RegEx [Example].kmmacros (13 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Extract Date from Lines of Text & Paste into Numbers

REQUIRES:

  1. KM 8.0.2+
  • But it can be written in KM 7.3.1+
  • It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
    .
  1. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro/script is just an Example

  • It has had very limited testing.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.
  • It may not be complete. It is provided as an example to show you one approach to solving a problem.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    *

TAGS: RegEx Apple Numbers Extract

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

image


Questions?


#5

Thank you! This is a start that I needed. I made a few modification and simplification to suite my workflow.

Copy Session Dates from OmniOutliner and Paste into Number

Comment.kmactions (1.5 KB)


#6

That's great!
If one of the above posts solves your problem/question as originally stated, please check the "Solved" checkbox (click for details) at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.

As I expected with an example macro.

You uploaded Actions. Please select the Macro, and upload the entire Macro file and image using the Share menu. See How to post/upload your script/macro.