Jump to content

Search the Community

Showing results for tags 'fileexists'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start






Found 7 results

  1. Hi all, I want to check if a file exists under the System32 folder: C:\Windows\System32\inetsrv\rewrite.dll The following code always worked for me: $string = @SystemDir & "\inetsrv\rewrite.dll" ConsoleWrite(FileExists($string)) But yesterday I updated my Windows 10 with the last "big" update and now my @SystemDir returns the following string: C:\Windows\SysWOW64 And before it was: C:\Windows\System32 So I thought I change my code to: $string = @WindowsDir & "\System32\inetsrv\rewrite.dll" ConsoleWrite(FileExists($string))But this code also does not work. I tried to run it as administrator but this also didn't work. What am I doing wrong? Regards, lrstndm
  2. Have the following code snippet: If not FileExists($ExchangeDir & $StockCSV) Then _FileWriteFromArray($ExchangeDir & $StockCSV, $YahooStockEntries) Else When trying to do a check against the non-existent file 'PRN.csv', FileExists is evaluating as True. This is not happening with other file names, directory structure is correct. Any ideas? Thanks Chip
  3. Hi All, I went searching for something to speed up checking for files on the network (UNC Paths) Most examples were rather complicated but someones multi-threaded solution gave me an idea. Hope it is useful to someone. Seems to work well so far. Func _FileExistsTimeout($sPath, $iTimeout = 1000) Local $hTimer = TimerInit() ; Begin the timer and store the handle in a variable. Local $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine "ConsoleWriteError(FileExists(""' & $sPath & '""))"', @ScriptDir, @SW_HIDE, $STDERR_CHILD) Local $sOutput = "" Local $iDiff = 0 While $iDiff < $iTimeout $iDiff = TimerDiff($hTimer) $sOutput &= StderrRead($iPID) If @error Then ; Exit the loop if the process closes or StderrRead returns an error. ExitLoop EndIf WEnd ProcessClose($iPID) Switch StringStripWS($sOutput, 8) Case 1 Return True Case Else Return False EndSwitch EndFunc ;==>_FileExistsTimeout
  4. Prior to posting this question, I have experimented with using FileExists, InetGetInfo and InetGet/InetClose functions to test downloading files into my application folder, in case if my file did not already exist. In my case, I was able to pinpoint to a very specific web address, eg.) https://dropbox.com, etc. and then check/download the file. Now my question is, instead of checking from a hardcoded URL, is it possible to: 1. Do a check against the IP address of a remote computer, eg.) my friend's or colleague's desktop computer 2. After checking the IP address if valid and can be connected to, access the computer's hard drive location, eg.) that machine's C:specifiedFolderspecifiedFile.txt 3. Download a copy of that file into a local computer I did read ('?do=embed' frameborder='0' data-embedContent>>) but that was what I accomplished earlier, so now I am not sure if I were to change the method of file retrieval, what changes are necessary?
  5. FileExists returns a false negative if the path string is quoted. Windows sometimes uses these quotes to distinguish between path and argument parts of a path string. Thus a path variable pulled from the registry must have the quotes stripped or FileExists gives a false negative. The dos exist command, comspec and the FileOpenDialog, with the "File Must Exist" flag set, also allows these quotes. Fixing this could also provide a method of extend the utility of FileExists and FileOpenDialog's "File Must Exist" flag without breaking any existing scripts. If FileExists optionally allowed these quotes, and only validated the string within the first pair of quotes if they exist, then script developers could easily validate a files existance even when it contains arguments quotes. Such as variables defined by path strings pulled from the registry, user supplied, etc. Of course a script developer can easily provide this functionality themselves by providing a wrapper function for FileExists.
  6. Why is it that if you send the function FileExists with a path that has quotes around it, for example see below, it tells you that the file/path doesn't exist? $drive = """C:""" ;$drive = "C:" Doesn't work ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $drive = ' & $drive & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console If FileExists($drive) Then MsgBox(4096, $drive & " Dir ", "Exists") Else MsgBox(4096, $drive & " Dir ", "Does NOT exists") EndIf $drive1 = "C:" ; $drive1 = C: Works ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $drive1 = ' & $drive1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console If FileExists($drive1) Then MsgBox(4096, "C: Dir ", "Exists") Else MsgBox(4096, "C: Dir", "Does NOT exists") EndIf If you're using FileExists with path names that you've put quotes around to work with other functions, you either have to check for the file before putting the quotes, or stripping them off before checking, which seems a little backwards. Not sure if I should report this as a bug, or something to add to the help file.
  7. So I am running a couple of computers on a local network. I am attempting to use FileExists to trigger events on an Autoit program running on each of them. Computer A makes a file (text1.txt) in a shared directory. Meanwhile, Computer B is running a tight loop with FileExists, checking for that file in a mapped drive: While $file1 = 0 $file1 = FileExists("Z:text1.txt") sleep(5000) WEnd However, when I put in some tracking (ConsoleWrite) things, it appears that it is only checking the Z: directory one time, and even when there is the 'text1.txt' file there after a couple of loops, it won't leave the loop. Is there something I should be doing to make FileExists "refresh" the directory? Should I be using something else to interface between the two machines? I could probably do a FileOpen, check for a particular line, and then FileClose.... it seems like more than I should need for this though. Suggestions anyone?
  • Create New...