Jump to content

delete the first or second element from array


 Share

Recommended Posts

im trying to sort the image array into slideshow with 4 images display everytime in a loop. when i choose the multiple images(around 12), the first element in the array is the path, so the slideshow would have a black one. how can I separate the path and assign the image into new array.

here is what i did so far, but not working

#include <Array.au3>

Global $aFiles = FileOpenDialog("select images", @WindowsDir & "\", "Images (*.jpg;*.bmp;*.png;*.gif)", 1 + 4)
Local $arr = StringSplit($aFiles, "|")
_ArrayDisplay($arr)
for $i=1 to UBound($arr)-1
   $arr[1]=$imagedir
   $narr[$i]=$arr[$i]
next

_ArrayDisplay($arr) looks like 

          col 0

row0   13

row1   c:userspics

row2   1.jpg

row3   2.jpg

...

etc

Thanks

Link to comment
Share on other sites

I am not 100% sure what you are trying to do but it seems like when you select files from the file open dialog they are all images and you want the first element to be the file path.  Everything before the for loop does that.   It also sounds like the the path is the problem for you because it is not an image so it shows a black background.  If that is the problem you don't need to delete anything ... just start your slideshow at $arr[2]. 

for $i=2 to UBound($arr)-1

Does that make sense?

Otherwise, if you wanted to delete it you could do this:

#include <Array.au3>
Global $aFiles = FileOpenDialog("select images", @WindowsDir & "\", "Images (*.jpg;*.bmp;*.png;*.gif)", 1 + 4)
Local $arr = StringSplit($aFiles, "|")
_ArrayDisplay($arr)
_ArrayDelete($arr,1); deletes index 1 element from array with directory
_ArrayDisplay($arr)
Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

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