BlazeLondon Posted March 28, 2006 Share Posted March 28, 2006 I've been stuck here before This should work right? the file doesnt get deleted as it is still open $file = FileOpen($file, 0) $line = FileReadLine("~locfldr.qbw") if $line = "1" Then FileClose($file) FileDelete ( $file ) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 28, 2006 Developers Share Posted March 28, 2006 I've been stuck here before This should work right? the file doesnt get deleted as it is still open $file = FileOpen($file, 0) $line = FileReadLine("~locfldr.qbw") if $line = "1" Then FileClose($file) FileDelete ( $file )What is the value of $file before the first line ?can you post a scriptlet that shows the issue when ran? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BlazeLondon Posted March 28, 2006 Author Share Posted March 28, 2006 What is the value of $file before the first line ?can you post a scriptlet that shows the issue when ran?the value is "0"there is a msgbox after the filedelete and then an exit statementwhen the message box is displayed the file should have gone, if you try and delete it in windows it says its in use Link to comment Share on other sites More sharing options...
Developers Jos Posted March 28, 2006 Developers Share Posted March 28, 2006 the value is "0"Value = 0 ???The filename for this statement i mean ?$file = FileOpen($file, 0) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BlazeLondon Posted March 28, 2006 Author Share Posted March 28, 2006 Value = 0 ???The filename for this statement i mean ?$file = FileOpen($file, 0)sorry make a file called ~locfldr.qbw with just 1 in it$file="~locfldr.qbw"$file = FileOpen($file, 0)$line = FileReadLine($file)if $line = "1" ThenFileClose($file)FileDelete ( $file ) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 28, 2006 Developers Share Posted March 28, 2006 (edited) you are overriding the filename with the filehandle thus trying to delete a file called 1 try this one: $filename="~locfldr.qbw" $file = FileOpen($filename, 0) $line = FileReadLine($file) if $line = "1" Then FileClose($file) FileDelete($filename ) EndIf Edited March 28, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BlazeLondon Posted March 28, 2006 Author Share Posted March 28, 2006 you are overriding the filename with the filehandle thus trying to delete a file called 1 try this one: $filename="~locfldr.qbw" $file = FileOpen($filename, 0) $line = FileReadLine($file) if $line = "1" Then FileClose($file) FileDelete($filename ) EndIfsame Link to comment Share on other sites More sharing options...
Developers Jos Posted March 28, 2006 Developers Share Posted March 28, 2006 same works for me..... did you check if it has run the filedelete ? like: $filename="~locfldr.qbw" $file = FileOpen($filename, 0) $line = FileReadLine($file) if $line = "1" Then FileClose($file) Sleep(50) FileDelete($filename ) ConsoleWrite('@@ Debug(7) : $filename = ' & $filename & @lf & '>Error code: ' & @error & ' Extended code: ' & @extended & @lf);### Debug Console EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BlazeLondon Posted March 28, 2006 Author Share Posted March 28, 2006 works for me..... did you check if it has run the filedelete ? like: $filename="~locfldr.qbw" $file = FileOpen($filename, 0) $line = FileReadLine($file) if $line = "1" Then FileClose($file) Sleep(50) FileDelete($filename ) ConsoleWrite('@@ Debug(7) : $filename = ' & $filename & @lf & '>Error code: ' & @error & ' Extended code: ' & @extended & @lf);### Debug Console EndIf ahhh! its being opened but not closed elsewhere in the script (blush) thank u for ur help sometimes i need to just have someone to talk it thru with appreciate it 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