Sign in to follow this  
Followers 0
salim

Any File in FileExists..??

7 posts in this topic

If FileExists("C:\autoexec.bat") Then

MsgBox(0, "Information..", "OK")

Else

MsgBox(0, "Information..", "U Lost Data")

EndIf

;Ok..

I want add any file in FileExists..

If FileExists("C:\autoexec.bat","Notepad.exe","cmd.exe") Then

MsgBox(0, "Information..", "OK")

Else

MsgBox(0, "Information..", "U Lost Data")

EndIf

; Error...

Thank's.. I hope i get the solution.. :gathering:

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

If FileExists("Back.bmp") and FileExists("button.bmp") and FileExists("Icon.bmp") Then

MsgBox(0, "Information..", "OK")

Else

MsgBox(0, "Information..", "U Lost Data")

EndIf

; Ok... Than's to

somdcomputerguy

It's posible to make filexists with array..??

How to create it's..?

Thank's just to know command in autoit.. :ILA2:

Edited by salim

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

#include <Array.au3>

Global $Array[3] = ['C:autoexec.bat', 'Notepad.exe', 'cmd.exe']

_ArrayDisplay($Array, 'Array')

$Yes = _FileExists($Array)

MsgBox(0, '?', 'Yes=' & $Yes & @CRLF &  'No=' & @extended)



Func _FileExists($Array)

    Local $Yes = 0, $No = UBound($Array)

    For $i = 0 To $No - 1

        If FileExists($Array[$i]) Then $Yes += 1

    Next

    Return SetError(0, $No - $Yes, $Yes)

EndFunc

Edited by AZJIO

Share this post


Link to post
Share on other sites

Thank

AZJIO

If i may ask again, what the mean

To $No - 1

and

Then $Yes += 1

why -1 and +=1 , if i change to 2 or 3 no efek in script. U'r scirpt no error message..

thank's..

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

$Yes += 1

means $Yes=$Yes+1

To $No - 1

this is because its an Array and the Ubound is the number of dimensions present starting from 1

whereas when we use the array the size starts from 0

=> $array[10] is $array[0], $array[1].....$array[9] {note 10 is not present, if it is called it will cause an error (i.e. $array[10]) }

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Oooww.. I see.. Thank's PhoneixXL..

Thak's for all..

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