Jump to content

Recommended Posts

Posted

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

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Will add to the wiki :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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)

 

Posted

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

Posted

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)

 

Posted

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)

 

 

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
×
×
  • Create New...