Jump to content

Recommended Posts

Posted

$handle = fileopen(@tempdir & "\xyz\q.txt",1)

FileWriteLine(@TempDir & "\xyz\q.txt","test")

FileClose( $handle )

_RunDOS("mydosprog.bat")

now this would seem to work fine however when mydosprog tries to rename q.txt it gets a file is already open in another app message.

it seems that the file is not properly closed until autoIT exits

any ideas?

Posted

1 solution:

;;;;;;;FILE WRITE.au3
$handle = fileopen(@tempdir & "\xyz\q.txt",1)
FileWriteLine(@TempDir & "\xyz\q.txt","test")
FileClose( $handle )
Exit

;;;;;;;;APP.au3
;AutoIt3 does not need to be installed for this run command to work. (assuming you have compilied this file)
Run(@AutoItEXE & " /AutoIt3ExecuteScript "&'"file write.au3"')
_RunDOS("mydosprog.bat")

#)

Posted

1 solution:

;;;;;;;FILE WRITE.au3
$handle = fileopen(@tempdir & "\xyz\q.txt",1)
FileWriteLine(@TempDir & "\xyz\q.txt","test")
FileClose( $handle )
Exit

;;;;;;;;APP.au3
;AutoIt3 does not need to be installed for this run command to work. (assuming you have compilied this file)
Run(@AutoItEXE & " /AutoIt3ExecuteScript "&'"file write.au3"')
_RunDOS("mydosprog.bat")

#)

yeh sure why not! well thought of! shame it will add another 250k compressed to the size of the distribution

thats the only prob with AutoIT the massive overhead of the engine that goes with the script

Posted

sorry i see what you mean (im really tired this project has been dragging on for weeks)

dont compile the 4 lines of text

could be done like this. would be better if AutoIT just closed the file i asked it to close properly!

but maybe like this..

Posted

Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function.Either use filehandles or filenames in your routines--not both.

Use the handle for FileWriteLine also.

$handle = fileopen(@tempdir & "\xyz\q.txt",1)

FileWriteLine($handle, "test")

FileClose( $handle )

_RunDOS("mydosprog.bat")

Posted

I have a felling that autoit is not the real culprit here (I do not know the internals). I have had the same problem in C when using the native MS Windows file commands. If I recall right the solution was to do a FileFlushBuffers(hFile) (win32 api call) even when it was no real reason to do so.

Regards

Uten

Posted

I have a felling that autoit is not the real culprit here (I do not know the internals). I have had the same problem in C when using the native MS Windows file commands. If I recall right the solution was to do a FileFlushBuffers(hFile) (win32 api call) even when it was no real reason to do so.

Regards

Uten

is that possible with AutoIT?

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...