Arrays

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 512
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Arrays

Post by PepsiHog » Sun May 18, 2014 3:23 am

I am using version 12, so forgive me if this is already in newer versions.

Some way of placing all arrays into one string. For example, RegEx gets a pattern and places each result in an array.
A command that would grab all arrays of a match and place them into a single string.

Such as:

GetArray>Matches,;,MyNumbers

Matches is the array. Simi the Delimeter. MyNumbers the result, containing all resulting arrays of Matches separated by simi.

I thought this would be useful for eliminating having to use loops to create such a string.

PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Arrays

Post by Marcus Tettmar » Mon May 19, 2014 9:24 am

Sounds like you want the opposite of Separate. That's an unusual but novel idea. There's no command to do it at present in one go but it can be done with a simple loop. Here's some code which starts out with a list, comma separated, turns it into an array and then turns it back to a string:

Code: Select all

Let>list=1,2,3,4,5
Separate>list,comma,items

Let>k=0
Let>newstr=
Repeat>k
  Let>k=k+1
  Let>this=items_%k%
  Let>newstr=%newstr%%this%
  If>k<items_count
    Let>newstr=%newstr%%comma%
  Endif
Until>k=items_count
A single line would be nice, but you can easily turn the above into a reusable subroutine.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

hagchr
Automation Wizard
Posts: 327
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: Arrays

Post by hagchr » Mon May 19, 2014 4:33 pm

There is a VBS function - Join(list[,delimiter]) - that takes a one-dimensional array and puts the elements together separated by the chosen delimiter. Could that maybe be used?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts