Sign in to follow this  
Followers 0
gnosis3d

Removing parts of an Array

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

If StringRight($ListPDF[$y], 4) = '.pdf' Then GUICtrlSetData($inprogressGUIListPDF, $ListPDF[$y] & "|", 1)

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Lookup StringInStr in the help

1.) I love you.

2.) See that's what gets me. Are Strings and Arrays different or not?

It works. You da man. "Woot." :)

Share this post


Link to post
Share on other sites

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 ]---

Share this post


Link to post
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
Sign in to follow this  
Followers 0