Jump to content

Check if file exists


meekaah
 Share

Recommended Posts

Hi, id like to check when opening a gui, to check if a file exists (that was created previously)

then use a _FileReadToArray($file,$array) so that i can fill up the inputboxes of the GUI like "GUICtrlSetData ( $input, $array[1])"

i know how to read text to array and fill up the input boxes that's not the issue, but i dont know how to check if a file exists,

and if not just use the default values for the input boxes

thanks in advance

I tried this:

$verify = FileOpen(@TempDir & "\profil1.txt", 0)
If $verify  <> "-1" then
    _FileReadToArray($verify,$array)
        
    GUICtrlSetData ( $input, $array[1])
EndIf

>The rest of the script...

But i allways get

GUICtrlSetData ( $input, $array[1])

GUICtrlSetData ( $input, $array^ ERROR

Subscript used with non-Array variable.

Edited by meekaah
Link to comment
Share on other sites

  • Developers

Hi, id like to check when opening a gui, to check if a file exists (that was created previously)

then use a _FileReadToArray($file,$array) so that i can fill up the inputboxes of the GUI like "GUICtrlSetData ( $input, $array[1])"

i know how to read text to array and fill up the input boxes that's not the issue, but i dont know how to check if a file exists,

and if not just use the default values for the input boxes

thanks in advance

-Mika

mmm.. FileExists()?

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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