Jump to content

Any File in FileExists..??


Recommended Posts

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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

#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
Link to comment
Share on other sites

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

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