How to use DelArray

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3524
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

How to use DelArray

Post by JRL » Wed May 09, 2012 4:36 pm

If I set up a simple array, DelArray removes it as advertised.

Code: Select all

Let>hh=0
Repeat>hh
  Add>hh,1
  Let>cell_%hh%=%hh%
Until>hh=10

MDL>cell_4

           DelArray>Cell

MDL>cell_4
If I have a more complex array with multiple elements, DelArray does not remove the array.

Code: Select all

Let>kk=0
Let>kkk=0
Repeat>kkk
  Add>kkk,1
  Repeat>kk
    Add>kk,1
    Let>cell_%kkk%_%kk%=%kkk%*%kk%
  Until>kk=10
  Let>kk=0
Until>kkk=10

MDL>Cell_8_2

           DelArray>Cell

MDL>Cell_8_2
Help for DelArray says:
DelArray>array_name,[,suffixformat]

Deletes the specified array. Deleting an array removes all array element variables from the variable table such that they are no longer available for use.
I suspect what I need is instruction on how to use "suffixformat". I've tried a couple of things but have not been able to get a multielement array to delete.

Any thoughts?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed May 09, 2012 9:02 pm

never mind...

User avatar
JRL
Automation Wizard
Posts: 3524
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed May 09, 2012 9:31 pm

You might get rep just for making me laugh :D

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed May 09, 2012 9:36 pm

Yeah, I was looking for the DelComment command :lol:

I pointed you to some help on suffixformat but then realized that it wasn't actually very helpful :(

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

Post by Marcus Tettmar » Thu May 10, 2012 9:00 am

DelArray can only work on arrays with a single dimension.

There's also a small bug in DelArray which can prevent some elements being deleted at all, and has been fixed in dev. So the fix should be public soon.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
JRL
Automation Wizard
Posts: 3524
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 10, 2012 7:49 pm

Ok... Thanks for letting us know.

So what is the purpose of suffixformat? Is it that an array formated like var_x might get deleted where a format like var(x) might not delete properly. What is the correct syntax for the suffixformat parameter?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Re:

Post by jpuziano » Tue Aug 26, 2014 3:32 pm

JRL wrote:Ok... Thanks for letting us know.

So what is the purpose of suffixformat? Is it that an array formated like var_x might get deleted where a format like var(x) might not delete properly. What is the correct syntax for the suffixformat parameter?
Hi JRL,

I also wondered about the format of suffixformat... because the Help File entry for the DelArray command does not explain or give examples of how to specify suffixformat...
ver 14.1.07 Help File wrote:DelArray>array_name,[,suffixformat]

Deletes the specified array. Deleting an array removes all array element variables from the variable table such that they are no longer available for use.

See also: DelVariable

Example:

DelArray>Names

More Examples and Comments Online
...however the Help File entries for ArraySort and ArrayCount do:
ver 14.1.07 Help File wrote:ArraySort>array_name,[,suffixformat]

Sorts the given array in ascending alphanumeric order.

Suffixformat is used to specify the format used for the array suffix as array variables in Macro Scheduler can take any format so desired. If omitted suffixformat is set to "_n" where n is the numeric placeholder. This would match an array with the format array_1, array_2, etc. An array format that looks like array[1], array[2] ... array[n] has the suffix format "[n]" (without the quotes).

ArraySort works with numeric array indexes only. Only arrays starting at index 0 or 1 will be recognised. ArraySort assumes that the array index advances by 1 for each element. If there are any gaps ArraySort will stop at the last element before the gap.

See also: ArrayCount, Arrays

Abbreviation: ARS

Example:

GetFileList>%SCRIPT_DIR%\*.*,MyFiles
Separate>MyFiles,;,FilesArray
ArraySort>FilesArray
Hi Marcus,

Please consider updating the Help File entry for the DelArray command so that it explains how to use the suffixformat parameter... just like it is explained in the entries for ArraySort and ArrayCount.

Thanks and take care
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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