Sign in to follow this  
Followers 0
linvin001

delete the first or second element from array

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

thanks. The path is the problem, I'm trying to switch between slideshow and browsers, so I need to make the image into infinite loop with only 5 or 6 image every time.

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