major098 Posted March 17, 2022 Posted March 17, 2022 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
Nine Posted March 17, 2022 Posted March 17, 2022 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. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
major098 Posted March 17, 2022 Author Posted March 17, 2022 Found way: $sTextFile = $sFolderPath & "\" & $aNewFileList[$i_1] $read= FileReadLine($sTextFile,1)
ad777 Posted March 17, 2022 Posted March 17, 2022 (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 March 17, 2022 by ad777 none
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