avery Posted June 17, 2008 Share Posted June 17, 2008 Func select_file1() $file1 = FileOpenDialog("Select Source File", "", "All (*.*)", 1 + 4) GUICtrlSetData($file1_input,$file1) $file1a = StringSplit($file1, "\") MsgBox(4, "MD5", $file1a[1]) ;MsgBox(4, "MD5", $file1a[-1]) -- ERRORS :( ... ... EndFuncHello,I'm trying to get the filename from the entire path -- code above. Can anyone please help me determine the total elements in an array so I can jump to the last one? Is there a better way to do this?ADVthanksANCE-avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
TehWhale Posted June 17, 2008 Share Posted June 17, 2008 (edited) -1 Holds no data, 0 holds how many is in there so they this: $String = StringSplit($File1, "\") $Path = $String[$String[0]] MsgBox(0, "$Path = ", $Path) EDIT: But of course this will fail if they hit the X or something, so use error checking too! Edited June 17, 2008 by JasonB Link to comment Share on other sites More sharing options...
Kerros Posted June 17, 2008 Share Posted June 17, 2008 Try MsgBox(4, "MD5", $file1a[ubound($file1a)-1]) Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
avery Posted June 17, 2008 Author Share Posted June 17, 2008 Thanks for the fast help. I'm moving forward again ;-) www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
TehWhale Posted June 17, 2008 Share Posted June 17, 2008 (edited) Thanks for the fast help. I'm moving forward again ;-)Did they both work? Seems as Kerros didn't work. Edited June 17, 2008 by JasonB Link to comment Share on other sites More sharing options...
Kerros Posted June 17, 2008 Share Posted June 17, 2008 why wouldn't that work? Local $file1a[7] = ['John Doe','Jane Sam','Billy Bob','Tom Jones','Frank','Mary','Lew'] MsgBox(4, "MD5", $file1a[ubound($file1a)-1]) That gives you a message box with "Lew" Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
TehWhale Posted June 17, 2008 Share Posted June 17, 2008 Ah, I was using it wrong! Link to comment Share on other sites More sharing options...
avery Posted June 17, 2008 Author Share Posted June 17, 2008 (edited) why wouldn't that work? Local $file1a[7] = ['John Doe','Jane Sam','Billy Bob','Tom Jones','Frank','Mary','Lew'] MsgBox(4, "MD5", $file1a[ubound($file1a)-1]) That gives you a message box with "Lew" I used the unbound method at first until I realized the reason the MD5 checksums changed when the path did was due to me using the UDF (user defined function?) in string mode not file. The short answer: I didn't end up using either one but none the less I learned a great deal in the process. Thanks again edit: I take that back -- I kept the Split for the Logfile text I generate Edited June 17, 2008 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now