ioliver 0 Posted March 15, 2004 I'm using the StringSplit() command to break up a file path by "\". I need to be able to find out what the last value in the Array is, because that will be part of a Window Title. The file path may change, so I can't hardcode this, the script needs to be able to find the last array value. Is there anyway to do this?Here is my code so far, but it don't work:$classlist = InputBox("(Class List) Filename?", "Type in the name of the file (Class List) you downloaded:")$clarray = StringSplit($classlist, "\")$x = 11Do $x = $x - 1Until $clarray($x) <> ""MsgBox(0,"Title",$clarray($x))Thanks for your Help,Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Share this post Link to post Share on other sites
Jos 2,165 Posted March 15, 2004 StringSplit will put the item count in $clarray[0]... You can also use UBound($clarray).... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
Chris_1013 0 Posted March 15, 2004 No need to loop, I'd use the UBound function for this, ie; $classlist = InputBox("(Class List) Filename?", "Type in the name of the file (Class List) you downloaded:") $clarray = StringSplit($classlist, "\") MsgBox(0,"Title",$clarray[uBound($clarray)-1])CODE] Also, remember when referencing individual array elements to use [], not (). Share this post Link to post Share on other sites
CyberSlug 6 Posted March 15, 2004 (edited) Remember that StringSplit will 'fail' if $classList does not contain "\", so you should check @error or use IsArray to prevent $clarray[uBound($clarray)-1] from crashing :iamstupid: Just ignore this post. Larry (correctly) points out below that ScriptSplit will not "fail" the way I describe Edited March 15, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Share this post Link to post Share on other sites
ioliver 0 Posted March 15, 2004 Thanks again for the all help. The UBound Command seems to work fine. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Share this post Link to post Share on other sites