faustf Posted June 23, 2020 Share Posted June 23, 2020 hi guys i have a program A this progrogram write datat over one file frequently(many time much fast and is a csv ), i try to read with autoit and work but ofeten tell me is not possible read (because is locked for write to program A), is possible have concurrent read and write ? thankz Link to comment Share on other sites More sharing options...
water Posted June 23, 2020 Share Posted June 23, 2020 IIRC this has been discussed on the forum. One suggestion was to create a lock file and check this before reading/writing. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 39 minutes ago, water said: IIRC this has been discussed on the forum. One suggestion was to create a lock file and check this before reading/writing. not wanna block a file because the program A stream over this file many data at milliseconds in some period of the day Link to comment Share on other sites More sharing options...
water Posted June 23, 2020 Share Posted June 23, 2020 You could use IPC (inter process communication) to send data from program A to program B. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 you have some example ? Link to comment Share on other sites More sharing options...
water Posted June 23, 2020 Share Posted June 23, 2020 The wiki / User Defined Functions / Inter Process Communications is full of different implementations. Select the one that suits your needs. Most of the time they come with examples too. NB: MailSlot by trancexx seems to be an easy and reliabl implementation. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 Take a look at my sig. I made a very simple IPC that I believe would nicely work with your requirements. “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 o thankz but the problem is the program A write data over csv , and program A is not mine , and is exe Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 I see. Then IPC is not a solution for you. Not sure if that would work, but look into _WinAPI_CreateFile to open a file in share read mode ? “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 the program A create a file and i want read with autoit , i just do it , but often giveme is lock Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 I know that, you already told us. You didn't answer my question ^^ Have you tried it, to open file csv file in program B with the WinAPI I suggested ? “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
water Posted June 23, 2020 Share Posted June 23, 2020 Will add to the wiki My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 2 hours ago, Nine said: I see. Then IPC is not a solution for you. Not sure if that would work, but look into _WinAPI_CreateFile to open a file in share read mode ? i create somthing like this but retun blank message Local $nBytes, $tBuffer $hFile = _WinAPI_CreateFile($sLFileCsvPath, 2, 2, 2) _WinAPI_ReadFile($hFile, $tBuffer, 6, $nBytes) _WinAPI_CloseHandle($hFile) $sText = BinaryToString(DllStructGetData($tBuffer, 1)) MsgBox(0,'',$sText) Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 i try to this mode Local $aLFile = FileReadToArray($sLFileCsvPath) Local $aug = UBound($aLFile) - 1 Local $aLFile2 = FileReadToArray($sLFileCsvPath) For $i = 0 To UBound($aLFile2) - 1 $aLba = StringSplit($aLFile2[$i], ";") ;_ArrayDisplay($aLba) GUICtrlCreateListViewItem($aLFile2[2] & "|" & $aLFile2[4] & "|" & $aLFile2[5], $List1) If $aLFile2[3] = "well" Then GUICtrlSetColor(-1, 0x4AA02C) ElseIf $aLFile2[3] = "mee" Then GUICtrlSetColor(-1, 0xFF0000) EndIf Next but in this mode the program continusly update the row , but not colored nothing and is like blocked Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 Try this : #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> Local $sTempFile = "Temp1.au3", $nBytes Local $tBuffer = DllStructCreate("char[20]") Local $hFile = _WinAPI_CreateFile($sTempFile, 2, 2) Local $iSize = _WinAPI_GetFileSizeEx($hFile) _WinAPI_ReadFile($hFile, $tBuffer, 20, $nBytes) _WinAPI_CloseHandle($hFile) Local $sText = DllStructGetData($tBuffer, 1) ConsoleWrite("File size = " & $iSize & " / " & "Read = " & $nBytes & "/" & $sText & @CRLF) “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 (edited) but read only first row , also if i insert this in loop Edited June 23, 2020 by faustf Link to comment Share on other sites More sharing options...
Nine Posted June 23, 2020 Share Posted June 23, 2020 I know that. But the real question is : does the file gets block or not using this approach. If it doesn't get block, you now have a solution. “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) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 yep Link to comment Share on other sites More sharing options...
faustf Posted June 23, 2020 Author Share Posted June 23, 2020 i finded a udf APITailRW.zip i tryed to read but not work #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <File.au3> #include "APITailRW.au3" Local $sTempFile = "C:\Users\pc\AppData\Data.csv" local $aArray=_FileReadLineAPI($sTempFile) _ArrayDisplay($aArray) 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