benjamindh Posted December 17, 2021 Share Posted December 17, 2021 (edited) Hello everyone, I have the following problem I have a code where I verify when starting the GUI if a file exists and if it actually exists, write the following name in the txt file adding the following symbol to the end of the text | so that the listbox can read the information of the document, but this does not work. Func Comprobar() Local $sFilePath = ("datos") Local $iFileExists = FileExists($sFilePath) If $iFileExists = ("BR2.cue") Then FileWrite ("info\List.txt", "Lenovo") EndIf EndFunc Edited December 17, 2021 by benjamindh Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 17, 2021 Moderators Share Posted December 17, 2021 (edited) Yes, and that is never going to work. You need to go back and read the help file for FileExists, and what it returns to understand why $iFileExists will never equal "BR2.cue" Edit: Or you could just wait for someone to give you the answer... Edited December 18, 2021 by JLogan3o13 pseakins 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
ad777 Posted December 17, 2021 Share Posted December 17, 2021 (edited) benjamindh your code should be : Func Comprobar() Local $sFilePath = ("datos") If FileExists($sFilePath) Then FileWrite ("info\List.txt", "Lenovo") EndIf EndFunc Edited December 17, 2021 by ad777 iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
benjamindh Posted December 17, 2021 Author Share Posted December 17, 2021 5 minutes ago, ad777 said: benjamindh your code should be : Func Comprobar() Local $sFilePath = ("datos") If FileExists($sFilePath) Then FileWrite ("info\List.txt", "Lenovo") EndIf EndFunc hello, I need to check if the BR2.cue file exists in the folder since there are several files in that folder and if it exists write lenovo in the txt document Link to comment Share on other sites More sharing options...
Solution ad777 Posted December 17, 2021 Solution Share Posted December 17, 2021 Func Comprobar() Local $sFilePath = "folder1\BR2.cue") If FileExists($sFilePath) Then FileWrite ("info\List.txt", "Lenovo") EndIf EndFunc iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now