gnosis3d Posted January 23, 2007 Share Posted January 23, 2007 Not new to AutoIt, but new to arrays... I am doing an FTP file list via array. This is outputted to a GUI List. However, I only want to display certain files in this list (basically, only lines w/ particular file extensions). I am not fully understanding how to actually REMOVE lines, or the opposite... pull particular lines OUT of the array and put them to a new array. Reference material would be nice. I can't find anything thusfar that fits this description (although the Search Forums brings up waaaay too much). This is what I've found in the forums and modified for my own usage: $ListPDF = _FTPFilesListToArray($Conn,2) If (Not IsArray($ListPDF)) Or (@error = 1) Then sleep(2) Return EndIf For $y = 1 To $ListPDF[0] GUICtrlSetData($inprogressGUIListPDF, $ListPDF[$y] & "|", 1) The $ListPDF is the array. How would I remove lines based on, for instance, ".jpg" or ".iso"? Again, the opposite would work as well. Extracting just ".pdf" extensions to a new array to output to the GUI List. Thanks in advance. Link to comment Share on other sites More sharing options...
sandyd Posted January 23, 2007 Share Posted January 23, 2007 $ListPDF = _FTPFilesListToArray($Conn,2) If (Not IsArray($ListPDF)) Or (@error = 1) Then sleep(2) Return EndIf For $y = 1 To $ListPDF[0] If StringInStr($ListPDF[$y], '.pdf') then GUICtrlSetData($inprogressGUIListPDF, $ListPDF[$y] & "|", 1) Endif Lookup StringInStr in the help ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2007 Moderators Share Posted January 23, 2007 (edited) If StringRight($ListPDF[$y], 4) = '.pdf' Then GUICtrlSetData($inprogressGUIListPDF, $ListPDF[$y] & "|", 1) Edited January 23, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
gnosis3d Posted January 23, 2007 Author Share Posted January 23, 2007 Lookup StringInStr in the help1.) I love you.2.) See that's what gets me. Are Strings and Arrays different or not?It works. You da man. "Woot." Link to comment Share on other sites More sharing options...
sandyd Posted January 23, 2007 Share Posted January 23, 2007 Depending on the programming language Strings can be arrays. Using Pascal, a string is really just an array of characters. Not sure how its represented in Autoit though. ----[ SandyD ]--- 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