Jump to content

Parsing an Input field with Comma Delimits?


EnigmaV8
 Share

Recommended Posts

Does anyone have an example or can whip something up real quick to show me how to parse an Input field using a comma as a delimiter? Even better if you could include a very simple FOR (I think?) example of doing an action to each delimited item. Maybe this would somehow use or populate an array? However if an array is the only good way to do this I only get support for 21 items per array?

ex. an Input field containing the text: computer1,computer2,computer3

Now parse out to do an action or section of script against "computer1" then against "computer2", etc. using I would assume a FOR command?

If any of this isn't clear Please feel free to ask for clerification.

Link to comment
Share on other sites

Not tested because for some reason my AV just decided to have a problem with something in AutoItWrapper... GRRR

$string= "computer1,computer2,computer3"
$tmp=StringSplit($string,",")
For $x = 1 To UBound($tmp)-1
    MsgBox(0,"","This is: " & $tmp[$x])
Next

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Dang that was fast!! ha ha You are TEH Awesome! :)

duh, of course had I actually searched for "delimiter" in the help I'm I would have seen the second result was StringSplit .... RTFM to me. :)

Still helps to see it all in action with a FOR like you have.

Thanks!

Anyone elses comments or variations are more than welcome!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...