Sign in to follow this  
Followers 0
FMS

If file exsist

3 posts in this topic

#1 ·  Posted (edited)

Hi all...

I'm making a script whit the following lines in it

If FileExists(@ScriptDir & "\file01.bmp") Then
    $path = (@ScriptDir & "\File01.bmp")
Else
    For $i1 = 0 to 9 step 1
    For $i2 = 0 to 9 step 1
        $path = (@ScriptDir & "\File" & $i1 & $i2 &".bmp")
EndIf

as you can see isn't it mush and not working :huh2:

I hope it's readeble for you guys but I wanna use a decending path number iff file 01 is exsisting.

So iff file01 exsist use file02 otherwise 03 ~....~ otherwise 11, 12, 13 etc.

Could somebody help me whit this?

thnx in advanced ;)

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$path = ""
$i = 0
Do
  $i += 1
  $path = @SCriptDir & "\File" & StringFormat("%02s", $i) & ".bmp"
Until Not FileExists($path)

Edit: Removed error in script.

Edited by Hannes123

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

YESZZZZZZZZzzzzzzzzzzz thnx alot thats what i was looking for :huh2:


as finishing touch god created the dutch

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