Jump to content

Recommended Posts

Posted

Hello, I'm using a script from a theard:

 

 

When new file is added, it info about it. What I'm trying to do is to read new added file to use detail from it in future:

 

"

FileOpen("unknown.txt",0)
MsgBox(0,"Test", FileReadLine("unknown.txt",1))

 

Problem is that file which will be added in a folder is unknow with random number letters, how can I read it than? Script from other theard see name of that file, but I cannot read it, tried few ways but no one worked yet. Maybe anyone could help?

 

Thank you

Posted

See _WinAPI_ReadDirectoryChanges

nb.  this is a blocking version of the API.  Take a look at the example.  See if it could fit your needs.  Otherwise, you can use the non-blocking version of the API, but it is not available as _WinAPI_* function from AutoIt.

Posted (edited)

@major098

to check new file's use below script:

#include <WinAPIFiles.au3>
_EnumFiles("D:\op\")
Func _EnumFiles($dir = "")
    Global $prev, $prev_o = "on"
    While 1
        Global $aData = _WinAPI_EnumFiles($dir, 1, '*.*;')
        For $i = 1 To $aData[0][0]
            if $prev_o = "on" Then
                for $i2 = 1 To $aData[0][0]
                    $prev = $prev & $aData[$i2][0] & @CRLF
                Next
                $prev_o = "off"
            EndIf
            if StringInStr($prev, $aData[$i][0]) Then
            Else
                MsgBox(0, '', $aData[$i][0])
                $prev = ""
                $prev_o = "on"
            EndIf
        Next

        Sleep(50)
    WEnd
EndFunc   ;==>_EnumFiles

to Read File use FileRead

Edited by ad777

none

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...