How to collect each character from a strings and loop it?

I am dealing with a timecode issue. what I really want to do is looping a [timecode] and type each digis from the numberpad.

for example:

string TIMECODE=01:02:03:04

I read Dan_Smith & JMichaelTX topic, which gives me big help. but now I Stuck on the looping.

Here is an example to get you started. It should do everything EXCEPT typing from the numberpad. It will simply type the digits. In most cases it should not matter whether the keystroke comes from the main keyboard or keypad.

MACRO:   Extract Digits from Timecode, & Type in Loop [Example]

**Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/6/8/6859b031e532d0895d96cb7e2de9d09f993c4810.kmmacros">Extract Digits from Timecode- & Type in Loop [Example].kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


---

### ReleaseNotes

Author.@JMichaelTX 

**PURPOSE:**

* **Extract Digits from Timecode & Type**

**HOW TO USE**

1. First, make sure you have followed instructions in the _Macro Setup_ below.
2. Make sure your active cursor is an app/document that will accept keystrokes
2. Trigger this macro.

**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.  ??
.
**Make These Changes to this Macro**
1. Assign a Trigger to this macro.
2. Move this macro to a Macro Group that is only Active when you need this Macro.
3. ENABLE this Macro, and the Macro Group it is in.
.
* **REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:**
(all shown in the magenta color)
   * Set Source String 
     * Enter your source string here.

**REQUIRES:**

1. **KM 9.0+** (may work in KM 8.2+ in some cases)
2. **macOS 10.11.6 (El Capitan)+**

TAGS:  @RegEx @Strings

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 a modest amount of 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.
<img src="/uploads/default/original/3X/5/5/55735fccb4cac850e453a16321d2037be3bbe4d2.png" width="515" height="1122">

Thanks Michael, You're awesome. Even when I don't know what I am asking.~~Lol

I will try it now , and let you know.

Thanks again have a good weekend.

Jeff

1 Like