TomCat Posted June 20, 2010 Share Posted June 20, 2010 Hi I have following Problem. I need to write some text into a file that is opened by an other process. If I try to write into the file like this: $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, "Line1") FileWrite($file, "Still Line1" & @CRLF) FileWrite($file, "Line2") FileClose($file) I get error Unable to open file. If I use iniwrite for same file i can write into the file. How can i force FileOpen now to open it for write into the file even if other process is writing to it? Or is their a way to unlock the other file with autoit? I hope someone here can help me Link to comment Share on other sites More sharing options...
Mat Posted June 20, 2010 Share Posted June 20, 2010 http://msdn.microsoft.com/en-us/library/aa365715(VS.85).aspx Not sure if that will work or not. AutoIt Project Listing Link to comment Share on other sites More sharing options...
TomCat Posted June 20, 2010 Author Share Posted June 20, 2010 Hi tnx for the answer but no doesnt work Any else ideas? Link to comment Share on other sites More sharing options...
KaFu Posted June 20, 2010 Share Posted June 20, 2010 Take a look at this thread, at least two different approaches (au3 dllcall or PSTools) are described there... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
TomCat Posted June 21, 2010 Author Share Posted June 21, 2010 does not work too :-/ looks like only way is to use unlocker with commandline in a script. 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