Jump to content
Macro Express Forums

Macro Express Pro - How to do If Conditional variable to match a Set of Strings (array)?

Recommended Posts

I'm trying to do a basic conditional if statement. I want to compare X to an array variable I have set. I basically have a preset array of strings I want to match a given variable to.


I currently have this:





if %name% = %name_ban[]%


I left out the number inside the bracket to match the entire array. can this be done or is there another method to match a variable to a set of strings within an array?

Link to comment
Share on other sites

Something like this may work as a starting point:

Variable Set Integer %Idx% to 0
Get Array Length (%name_ban%) => %Max%
Repeat Until %Idx% Is Greater Than or Equal To "%Max%"
  Variable Modify Integer %Idx%: Increment
  If Variable %name% Equals "%name_ban[%Idx%]%"
  // Do something special here
  End If
End Repeat
Link to comment
Share on other sites

MEP doesn't have any array manipulation commands. I have a collection of macro subroutines to do various things like finding the index of a member, count, sort, and so forth. Also I find it valuable to create a values when I induct the data. Say for instance I loop through some text to propagate an array. I'll also count the number of members at that time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...