BlazeLondon Posted March 16, 2006 Posted March 16, 2006 $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?
nfwu Posted March 16, 2006 Posted March 16, 2006 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") #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode()
BlazeLondon Posted March 16, 2006 Author Posted March 16, 2006 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
BlazeLondon Posted March 16, 2006 Author Posted March 16, 2006 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..
nfwu Posted March 16, 2006 Posted March 16, 2006 Or you could Write the 4 lines of code to a au3 file (in you application), then run it? #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode()
MHz Posted March 16, 2006 Posted March 16, 2006 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")
BlazeLondon Posted March 16, 2006 Author Posted March 16, 2006 Use the handle for FileWriteLine also.sadly for some reason that still doesn't work!maybe i'll try the other idea calling another autoit script
Uten Posted March 16, 2006 Posted March 16, 2006 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 Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
BlazeLondon Posted March 16, 2006 Author Posted March 16, 2006 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. RegardsUtenis that possible with AutoIT?
CyberSlug Posted March 16, 2006 Posted March 16, 2006 I cannot duplicate the problem. I wonder if adding a sleep statement between FileClose and _RunDOS would help? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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