Jump to content

Array with for loop skips 1 image why?


Recommended Posts

Hi all,

Have a little problem getting my code to work the way i want, i managed it to count the files that ends with .jpg, but it only shows 1 picture less then there is in the folder, like if i have 10 .jpg's it only shows 9 before it exits, i tried it with a foor loop with step - 1, same thing, and i tried this way like below.

#include <File.au3>
#include <Array.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
Global $pixtures
Global $filecount
Call("findthem")





Local $i = 0
Do
        GUICreate('Picit', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST))
    GUICtrlCreatePic(@ScriptDir & "\" & $pixtures[$filecount], 0, 0, @DesktopWidth, @DesktopHeight)
    GUISetState()
    Sleep(1000)
    $i = $i + 1
    $filecount = $filecount - 1
Until $i = $pixtures[0]




Func findthem()
    $pixtures = _FileListToArray(@ScriptDir,"*.jpg")
    If @error = 4 Then
    MsgBox(0, "", "Hittade inga bilder.")
    Exit
EndIf
_ArrayDisplay($pixtures)
$filecount = $pixtures[0]
EndFunc

Nevermind i noticed the error when i posted, :), this works

Edited by smellyfingers
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

×
×
  • Create New...